mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-18 18:18:23 -05:00
PLT-6761 fixing unit tests (#6671)
This commit is contained in:
parent
36f216cb7c
commit
e2cc0df2e8
11 changed files with 284 additions and 284 deletions
|
|
@ -25,7 +25,7 @@ func TestCreateChannel(t *testing.T) {
|
|||
th.LoginBasic()
|
||||
th.BasicClient.SetTeamId(team.Id)
|
||||
|
||||
channel := model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel := model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
rchannel, err := Client.CreateChannel(&channel)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -89,7 +89,7 @@ func TestCreateChannel(t *testing.T) {
|
|||
t.Fatal("Should have errored out on invalid '__' character")
|
||||
}
|
||||
|
||||
channel = model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_DIRECT, TeamId: team.Id}
|
||||
channel = model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_DIRECT, TeamId: team.Id}
|
||||
|
||||
if _, err := Client.CreateChannel(&channel); err == nil {
|
||||
t.Fatal("Should have errored out on direct channel type")
|
||||
|
|
@ -113,8 +113,8 @@ func TestCreateChannel(t *testing.T) {
|
|||
utils.License = &model.License{Features: &model.Features{}}
|
||||
utils.License.Features.SetDefaults()
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
if _, err := Client.CreateChannel(channel2); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -127,8 +127,8 @@ func TestCreateChannel(t *testing.T) {
|
|||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
th.LoginBasic2()
|
||||
channel2.Name = "a" + model.NewId() + "a"
|
||||
channel3.Name = "a" + model.NewId() + "a"
|
||||
channel2.Name = "zz" + model.NewId() + "a"
|
||||
channel3.Name = "zz" + model.NewId() + "a"
|
||||
if _, err := Client.CreateChannel(channel2); err == nil {
|
||||
t.Fatal("should have errored not team admin")
|
||||
}
|
||||
|
|
@ -152,8 +152,8 @@ func TestCreateChannel(t *testing.T) {
|
|||
*utils.Cfg.TeamSettings.RestrictPrivateChannelCreation = model.PERMISSIONS_SYSTEM_ADMIN
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel2.Name = "a" + model.NewId() + "a"
|
||||
channel3.Name = "a" + model.NewId() + "a"
|
||||
channel2.Name = "zz" + model.NewId() + "a"
|
||||
channel3.Name = "zz" + model.NewId() + "a"
|
||||
if _, err := Client.CreateChannel(channel2); err == nil {
|
||||
t.Fatal("should have errored not system admin")
|
||||
}
|
||||
|
|
@ -175,8 +175,8 @@ func TestCreateChannel(t *testing.T) {
|
|||
utils.License = nil
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel4 := model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel5 := model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel4 := model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel5 := model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
if _, err := Client.CreateChannel(&channel4); err != nil {
|
||||
t.Fatal("should have succeeded")
|
||||
}
|
||||
|
|
@ -285,13 +285,13 @@ func TestUpdateChannel(t *testing.T) {
|
|||
|
||||
Client.Login(user.Email, user.Password)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
Client.AddChannelMember(channel1.Id, user.Id)
|
||||
|
||||
header := "a" + model.NewId() + "a"
|
||||
purpose := "a" + model.NewId() + "a"
|
||||
header := "zz" + model.NewId() + "a"
|
||||
purpose := "zz" + model.NewId() + "a"
|
||||
upChannel1 := &model.Channel{Id: channel1.Id, Header: header, Purpose: purpose}
|
||||
upChannel1 = Client.Must(Client.UpdateChannel(upChannel1)).Data.(*model.Channel)
|
||||
|
||||
|
|
@ -496,7 +496,7 @@ func TestUpdateChannelDisplayName(t *testing.T) {
|
|||
|
||||
Client.Login(user.Email, user.Password)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
Client.AddChannelMember(channel1.Id, user.Id)
|
||||
|
|
@ -519,7 +519,7 @@ func TestUpdateChannelHeader(t *testing.T) {
|
|||
SystemAdminClient := th.SystemAdminClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
data := make(map[string]string)
|
||||
|
|
@ -715,7 +715,7 @@ func TestUpdateChannelPurpose(t *testing.T) {
|
|||
SystemAdminClient := th.SystemAdminClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
data := make(map[string]string)
|
||||
|
|
@ -896,10 +896,10 @@ func TestGetChannel(t *testing.T) {
|
|||
team := th.BasicTeam
|
||||
team2 := th.CreateTeam(Client)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
rget := Client.Must(Client.GetChannels(""))
|
||||
|
|
@ -968,7 +968,7 @@ func TestGetMoreChannelsPage(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "b" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
|
|
@ -1037,10 +1037,10 @@ func TestGetChannelCounts(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
if result, err := Client.GetChannelCounts(""); err != nil {
|
||||
|
|
@ -1071,10 +1071,10 @@ func TestGetMyChannelMembers(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
if result, err := Client.GetMyChannelMembers(); err != nil {
|
||||
|
|
@ -1095,10 +1095,10 @@ func TestJoinChannelById(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 = Client.Must(Client.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
|
||||
th.LoginBasic2()
|
||||
|
|
@ -1139,10 +1139,10 @@ func TestJoinChannelByName(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 = Client.Must(Client.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
|
||||
th.LoginBasic2()
|
||||
|
|
@ -1183,7 +1183,7 @@ func TestJoinChannelByNameDisabledUser(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
Client.Must(th.BasicClient.RemoveUserFromTeam(th.BasicTeam.Id, th.BasicUser.Id))
|
||||
|
|
@ -1202,10 +1202,10 @@ func TestLeaveChannel(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 = Client.Must(Client.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
|
||||
th.LoginBasic2()
|
||||
|
|
@ -1247,17 +1247,17 @@ func TestDeleteChannel(t *testing.T) {
|
|||
|
||||
Client.Login(user2.Email, user2.Password)
|
||||
|
||||
channelMadeByCA := &model.Channel{DisplayName: "C Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channelMadeByCA := &model.Channel{DisplayName: "C Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channelMadeByCA = Client.Must(Client.CreateChannel(channelMadeByCA)).Data.(*model.Channel)
|
||||
|
||||
Client.AddChannelMember(channelMadeByCA.Id, userTeamAdmin.Id)
|
||||
|
||||
Client.Login(userTeamAdmin.Email, "pwd")
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
if _, err := Client.DeleteChannel(channel1.Id); err != nil {
|
||||
|
|
@ -1268,7 +1268,7 @@ func TestDeleteChannel(t *testing.T) {
|
|||
t.Fatal("Team admin failed to delete Channel Admin's channel")
|
||||
}
|
||||
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
if _, err := Client.CreatePost(post1); err == nil {
|
||||
t.Fatal("should have failed to post to deleted channel")
|
||||
}
|
||||
|
|
@ -1310,7 +1310,7 @@ func TestDeleteChannel(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "B Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel3 = Client.Must(Client.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
|
||||
Client.Login(userSystemAdmin.Email, userSystemAdmin.Password)
|
||||
|
|
@ -1519,7 +1519,7 @@ func TestGetChannelStats(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
rget := Client.Must(Client.GetChannelStats(channel1.Id, ""))
|
||||
|
|
@ -1539,7 +1539,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
user2 := th.BasicUser2
|
||||
user3 := th.CreateUser(Client)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
if _, err := Client.AddChannelMember(channel1.Id, user2.Id); err != nil {
|
||||
|
|
@ -1562,7 +1562,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
t.Fatal("Should have errored, bad channel id")
|
||||
}
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
th.LoginBasic2()
|
||||
|
|
@ -1591,7 +1591,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
*utils.Cfg.TeamSettings.RestrictPrivateChannelManageMembers = model.PERMISSIONS_CHANNEL_ADMIN
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 = Client.Must(th.SystemAdminClient.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel3.Id, user1.Id))
|
||||
if _, err := Client.AddChannelMember(channel3.Id, user2.Id); err != nil {
|
||||
|
|
@ -1613,7 +1613,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
// Check that a regular channel user can add other users.
|
||||
channel4 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel4 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel4 = Client.Must(th.SystemAdminClient.CreateChannel(channel4)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel4.Id, user1.Id))
|
||||
if _, err := Client.AddChannelMember(channel4.Id, user2.Id); err != nil {
|
||||
|
|
@ -1627,7 +1627,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
utils.License.Features.SetDefaults()
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel5 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel5 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel5 = Client.Must(th.SystemAdminClient.CreateChannel(channel5)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel5.Id, user1.Id))
|
||||
if _, err := Client.AddChannelMember(channel5.Id, user2.Id); err == nil {
|
||||
|
|
@ -1652,7 +1652,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
utils.License.Features.SetDefaults()
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel6 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel6 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel6 = Client.Must(th.SystemAdminClient.CreateChannel(channel6)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel6.Id, user1.Id))
|
||||
if _, err := Client.AddChannelMember(channel6.Id, user2.Id); err == nil {
|
||||
|
|
@ -1677,7 +1677,7 @@ func TestAddChannelMember(t *testing.T) {
|
|||
utils.License.Features.SetDefaults()
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel7 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel7 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel7 = Client.Must(th.SystemAdminClient.CreateChannel(channel7)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel7.Id, user1.Id))
|
||||
if _, err := Client.AddChannelMember(channel7.Id, user2.Id); err == nil {
|
||||
|
|
@ -1697,14 +1697,14 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
user2 := th.BasicUser2
|
||||
UpdateUserToTeamAdmin(user2, team)
|
||||
|
||||
channelMadeByCA := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channelMadeByCA := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channelMadeByCA = Client.Must(Client.CreateChannel(channelMadeByCA)).Data.(*model.Channel)
|
||||
|
||||
Client.Must(Client.AddChannelMember(channelMadeByCA.Id, user2.Id))
|
||||
|
||||
th.LoginBasic2()
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
userStd := th.CreateUser(th.BasicClient)
|
||||
|
|
@ -1730,7 +1730,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
t.Fatal("Team Admin failed to remove member from Channel Admin's channel")
|
||||
}
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
Client.Login(userStd.Email, userStd.Password)
|
||||
|
|
@ -1764,7 +1764,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
*utils.Cfg.TeamSettings.RestrictPrivateChannelManageMembers = model.PERMISSIONS_CHANNEL_ADMIN
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel3 = Client.Must(th.SystemAdminClient.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel3.Id, user1.Id))
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel3.Id, user2.Id))
|
||||
|
|
@ -1787,7 +1787,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
// Check that a regular channel user can remove other users.
|
||||
channel4 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel4 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel4 = Client.Must(th.SystemAdminClient.CreateChannel(channel4)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel4.Id, user1.Id))
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel4.Id, user2.Id))
|
||||
|
|
@ -1802,7 +1802,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
utils.License.Features.SetDefaults()
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel5 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel5 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel5 = Client.Must(th.SystemAdminClient.CreateChannel(channel5)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel5.Id, user1.Id))
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel5.Id, user2.Id))
|
||||
|
|
@ -1827,7 +1827,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
utils.License.Features.SetDefaults()
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel6 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel6 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel6 = Client.Must(th.SystemAdminClient.CreateChannel(channel6)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel6.Id, user1.Id))
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel6.Id, user2.Id))
|
||||
|
|
@ -1853,7 +1853,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||
utils.License.Features.SetDefaults()
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
channel7 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel7 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel7 = Client.Must(th.SystemAdminClient.CreateChannel(channel7)).Data.(*model.Channel)
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel7.Id, user1.Id))
|
||||
Client.Must(th.SystemAdminClient.AddChannelMember(channel7.Id, user2.Id))
|
||||
|
|
@ -1873,7 +1873,7 @@ func TestUpdateNotifyProps(t *testing.T) {
|
|||
user := th.BasicUser
|
||||
user2 := th.BasicUser2
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
data := make(map[string]string)
|
||||
|
|
@ -2041,7 +2041,7 @@ func TestFuzzyChannel(t *testing.T) {
|
|||
}
|
||||
|
||||
for i := 0; i < len(fuzzyStringsPass); i++ {
|
||||
channel := model.Channel{DisplayName: fuzzyStringsPass[i], Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel := model.Channel{DisplayName: fuzzyStringsPass[i], Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
|
||||
_, err := Client.CreateChannel(&channel)
|
||||
if err != nil {
|
||||
|
|
@ -2055,7 +2055,7 @@ func TestGetChannelMember(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
if result, err := Client.GetChannelMember(channel1.Id, th.BasicUser.Id); err != nil {
|
||||
|
|
@ -2093,7 +2093,7 @@ func TestSearchMoreChannels(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "TestAPINameA", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "TestAPINameA", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "TestAPINameB", Name: "b" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
|
|
@ -2170,7 +2170,7 @@ func TestAutocompleteChannels(t *testing.T) {
|
|||
Client := th.BasicClient
|
||||
team := th.BasicTeam
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "TestAPINameA", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "TestAPINameA", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "TestAPINameB", Name: "b" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
|
|
@ -2360,7 +2360,7 @@ func TestUpdateChannelRoles(t *testing.T) {
|
|||
// User 1 creates a channel, making them channel admin by default.
|
||||
createChannel := model.Channel{
|
||||
DisplayName: "Test API Name",
|
||||
Name: "a" + model.NewId() + "a",
|
||||
Name: "zz" + model.NewId() + "a",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
TeamId: th.BasicTeam.Id,
|
||||
}
|
||||
|
|
|
|||
118
api/post_test.go
118
api/post_test.go
|
|
@ -53,40 +53,40 @@ func TestCreatePost(t *testing.T) {
|
|||
t.Fatal("Newly craeted post shouldn't have EditAt set")
|
||||
}
|
||||
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
rpost2, err := Client.CreatePost(post2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id, ParentId: rpost2.Data.(*model.Post).Id}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id, ParentId: rpost2.Data.(*model.Post).Id}
|
||||
_, err = Client.CreatePost(post3)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
post4 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: "junk"}
|
||||
post4 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: "junk"}
|
||||
_, err = Client.CreatePost(post4)
|
||||
if err.StatusCode != http.StatusBadRequest {
|
||||
t.Fatal("Should have been invalid param")
|
||||
}
|
||||
|
||||
post5 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id, ParentId: "junk"}
|
||||
post5 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id, ParentId: "junk"}
|
||||
_, err = Client.CreatePost(post5)
|
||||
if err.StatusCode != http.StatusBadRequest {
|
||||
t.Fatal("Should have been invalid param")
|
||||
}
|
||||
|
||||
post1c2 := &model.Post{ChannelId: channel2.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1c2 := &model.Post{ChannelId: channel2.Id, Message: "zz" + model.NewId() + "a"}
|
||||
rpost1c2, err := Client.CreatePost(post1c2)
|
||||
|
||||
post2c2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1c2.Data.(*model.Post).Id}
|
||||
post2c2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1c2.Data.(*model.Post).Id}
|
||||
_, err = Client.CreatePost(post2c2)
|
||||
if err.StatusCode != http.StatusBadRequest {
|
||||
t.Fatal("Should have been invalid param")
|
||||
}
|
||||
|
||||
post6 := &model.Post{ChannelId: "junk", Message: "a" + model.NewId() + "a"}
|
||||
post6 := &model.Post{ChannelId: "junk", Message: "zz" + model.NewId() + "a"}
|
||||
_, err = Client.CreatePost(post6)
|
||||
if err.StatusCode != http.StatusForbidden {
|
||||
t.Fatal("Should have been forbidden")
|
||||
|
|
@ -94,7 +94,7 @@ func TestCreatePost(t *testing.T) {
|
|||
|
||||
th.LoginBasic2()
|
||||
|
||||
post7 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post7 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
_, err = Client.CreatePost(post7)
|
||||
if err.StatusCode != http.StatusForbidden {
|
||||
t.Fatal("Should have been forbidden")
|
||||
|
|
@ -104,7 +104,7 @@ func TestCreatePost(t *testing.T) {
|
|||
Client.SetTeamId(team2.Id)
|
||||
channel3 := th.CreateChannel(Client, team2)
|
||||
|
||||
post8 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post8 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
_, err = Client.CreatePost(post8)
|
||||
if err.StatusCode != http.StatusForbidden {
|
||||
t.Fatal("Should have been forbidden")
|
||||
|
|
@ -325,7 +325,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
|
||||
*utils.Cfg.ServiceSettings.AllowEditPost = model.ALLOW_EDIT_POST_ALWAYS
|
||||
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
rpost1, err := Client.CreatePost(post1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -335,7 +335,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
t.Fatal("full name didn't match")
|
||||
}
|
||||
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
rpost2, err := Client.CreatePost(post2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -345,7 +345,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
t.Fatal("Newly craeted post shouldn't have EditAt set")
|
||||
}
|
||||
|
||||
msg2 := "a" + model.NewId() + " update post 1"
|
||||
msg2 := "zz" + model.NewId() + " update post 1"
|
||||
rpost2.Data.(*model.Post).Message = msg2
|
||||
if rupost2, err := Client.UpdatePost(rpost2.Data.(*model.Post)); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -368,7 +368,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
up12 := &model.Post{Id: rpost1.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "a" + model.NewId() + " updaet post 1 update 2"}
|
||||
up12 := &model.Post{Id: rpost1.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "zz" + model.NewId() + " updaet post 1 update 2"}
|
||||
if rup12, err := Client.UpdatePost(up12); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
|
|
@ -377,13 +377,13 @@ func TestUpdatePost(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", Type: model.POST_JOIN_LEAVE}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", Type: model.POST_JOIN_LEAVE}
|
||||
rpost3, err := Client.CreatePost(post3)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
up3 := &model.Post{Id: rpost3.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "a" + model.NewId() + " update post 3"}
|
||||
up3 := &model.Post{Id: rpost3.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "zz" + model.NewId() + " update post 3"}
|
||||
if _, err := Client.UpdatePost(up3); err == nil {
|
||||
t.Fatal("shouldn't have been able to update system message")
|
||||
}
|
||||
|
|
@ -401,13 +401,13 @@ func TestUpdatePost(t *testing.T) {
|
|||
|
||||
*utils.Cfg.ServiceSettings.AllowEditPost = model.ALLOW_EDIT_POST_NEVER
|
||||
|
||||
post4 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
post4 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
rpost4, err := Client.CreatePost(post4)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
up4 := &model.Post{Id: rpost4.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "a" + model.NewId() + " update post 4"}
|
||||
up4 := &model.Post{Id: rpost4.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "zz" + model.NewId() + " update post 4"}
|
||||
if _, err := Client.UpdatePost(up4); err == nil {
|
||||
t.Fatal("shouldn't have been able to update a message when not allowed")
|
||||
}
|
||||
|
|
@ -415,13 +415,13 @@ func TestUpdatePost(t *testing.T) {
|
|||
*utils.Cfg.ServiceSettings.AllowEditPost = model.ALLOW_EDIT_POST_TIME_LIMIT
|
||||
*utils.Cfg.ServiceSettings.PostEditTimeLimit = 1 //seconds
|
||||
|
||||
post5 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
post5 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
|
||||
rpost5, err := Client.CreatePost(post5)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
msg5 := "a" + model.NewId() + " update post 5"
|
||||
msg5 := "zz" + model.NewId() + " update post 5"
|
||||
up5 := &model.Post{Id: rpost5.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: msg5}
|
||||
if rup5, err := Client.UpdatePost(up5); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -433,7 +433,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
|
||||
up6 := &model.Post{Id: rpost5.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "a" + model.NewId() + " update post 5"}
|
||||
up6 := &model.Post{Id: rpost5.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "zz" + model.NewId() + " update post 5"}
|
||||
if _, err := Client.UpdatePost(up6); err == nil {
|
||||
t.Fatal("shouldn't have been able to update a message after time limit")
|
||||
}
|
||||
|
|
@ -445,23 +445,23 @@ func TestGetPosts(t *testing.T) {
|
|||
channel1 := th.BasicChannel
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 = Client.Must(Client.CreatePost(post1a1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post3 = Client.Must(Client.CreatePost(post3)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 = Client.Must(Client.CreatePost(post3a1)).Data.(*model.Post)
|
||||
|
||||
r1 := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Data.(*model.PostList)
|
||||
|
|
@ -500,27 +500,27 @@ func TestGetPostsSince(t *testing.T) {
|
|||
channel1 := th.BasicChannel
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post0 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post0 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post0 = Client.Must(Client.CreatePost(post0)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 = Client.Must(Client.CreatePost(post1a1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post3 = Client.Must(Client.CreatePost(post3)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 = Client.Must(Client.CreatePost(post3a1)).Data.(*model.Post)
|
||||
|
||||
r1 := Client.Must(Client.GetPostsSince(channel1.Id, post1.CreateAt)).Data.(*model.PostList)
|
||||
|
|
@ -560,27 +560,27 @@ func TestGetPostsBeforeAfter(t *testing.T) {
|
|||
channel1 := th.BasicChannel
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post0 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post0 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post0 = Client.Must(Client.CreatePost(post0)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 = Client.Must(Client.CreatePost(post1a1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post3 = Client.Must(Client.CreatePost(post3)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 = Client.Must(Client.CreatePost(post3a1)).Data.(*model.Post)
|
||||
|
||||
r1 := Client.Must(Client.GetPostsBefore(channel1.Id, post1a1.Id, 0, 10, "")).Data.(*model.PostList)
|
||||
|
|
@ -698,10 +698,10 @@ func TestSearchPostsInChannel(t *testing.T) {
|
|||
post1 := &model.Post{ChannelId: channel1.Id, Message: "sgtitlereview with space"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
channel2 := &model.Channel{DisplayName: "TestGetPosts", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "TestGetPosts", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
|
||||
channel3 := &model.Channel{DisplayName: "TestGetPosts", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel3 := &model.Channel{DisplayName: "TestGetPosts", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel3 = Client.Must(Client.CreateChannel(channel3)).Data.(*model.Channel)
|
||||
|
||||
post2 := &model.Post{ChannelId: channel2.Id, Message: "sgtitlereview\n with return"}
|
||||
|
|
@ -831,15 +831,15 @@ func TestGetPostsCache(t *testing.T) {
|
|||
channel1 := th.BasicChannel
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post3 = Client.Must(Client.CreatePost(post3)).Data.(*model.Post)
|
||||
|
||||
etag := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Etag
|
||||
|
|
@ -879,27 +879,27 @@ func TestDeletePosts(t *testing.T) {
|
|||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id}
|
||||
post1a1 = Client.Must(Client.CreatePost(post1a1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1a2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post1.Id, ParentId: post1a1.Id}
|
||||
post1a2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id, ParentId: post1a1.Id}
|
||||
post1a2 = Client.Must(Client.CreatePost(post1a2)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post3 = Client.Must(Client.CreatePost(post3)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: post3.Id}
|
||||
post3a1 = Client.Must(Client.CreatePost(post3a1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
|
@ -912,11 +912,11 @@ func TestDeletePosts(t *testing.T) {
|
|||
}
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post4a := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post4a := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post4a = Client.Must(Client.CreatePost(post4a)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post4b := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post4b := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post4b = Client.Must(Client.CreatePost(post4b)).Data.(*model.Post)
|
||||
|
||||
SystemAdminClient := th.SystemAdminClient
|
||||
|
|
@ -957,11 +957,11 @@ func TestDeletePosts(t *testing.T) {
|
|||
th.LoginBasic()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post5a := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post5a := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post5a = Client.Must(Client.CreatePost(post5a)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post5b := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post5b := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post5b = Client.Must(Client.CreatePost(post5b)).Data.(*model.Post)
|
||||
|
||||
if _, err := Client.DeletePost(channel1.Id, post5a.Id); err == nil {
|
||||
|
|
@ -980,7 +980,7 @@ func TestDeletePosts(t *testing.T) {
|
|||
th.LoginBasic()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post6a := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post6a := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post6a = Client.Must(Client.CreatePost(post6a)).Data.(*model.Post)
|
||||
|
||||
if _, err := Client.DeletePost(channel1.Id, post6a.Id); err == nil {
|
||||
|
|
@ -999,7 +999,7 @@ func TestDeletePosts(t *testing.T) {
|
|||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post7 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post7 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post7 = Client.Must(Client.CreatePost(post7)).Data.(*model.Post)
|
||||
|
||||
if _, err := Client.DeletePost(channel1.Id, post7.Id); err != nil {
|
||||
|
|
@ -1274,11 +1274,11 @@ func TestGetPermalinkTmp(t *testing.T) {
|
|||
th.LoginBasic()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
|
||||
post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
|
||||
|
||||
etag := Client.Must(Client.GetPost(channel1.Id, post1.Id, "")).Etag
|
||||
|
|
@ -1298,10 +1298,10 @@ func TestGetPermalinkTmp(t *testing.T) {
|
|||
}
|
||||
|
||||
// Test permalink to private channels.
|
||||
channel2 := &model.Channel{DisplayName: "TestGetPermalinkPriv", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel2 := &model.Channel{DisplayName: "TestGetPermalinkPriv", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
|
||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post3 := &model.Post{ChannelId: channel2.Id, Message: "a" + model.NewId() + "a"}
|
||||
post3 := &model.Post{ChannelId: channel2.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post3 = Client.Must(Client.CreatePost(post3)).Data.(*model.Post)
|
||||
|
||||
if _, md := Client.GetPermalink(channel2.Id, post3.Id, ""); md.Error != nil {
|
||||
|
|
@ -1318,7 +1318,7 @@ func TestGetPermalinkTmp(t *testing.T) {
|
|||
th.LoginBasic()
|
||||
channel3 := Client.Must(Client.CreateDirectChannel(th.SystemAdminUser.Id)).Data.(*model.Channel)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
post4 := &model.Post{ChannelId: channel3.Id, Message: "a" + model.NewId() + "a"}
|
||||
post4 := &model.Post{ChannelId: channel3.Id, Message: "zz" + model.NewId() + "a"}
|
||||
post4 = Client.Must(Client.CreatePost(post4)).Data.(*model.Post)
|
||||
|
||||
if _, md := Client.GetPermalink(channel3.Id, post4.Id, ""); md.Error != nil {
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ func TestTeamPermDelete(t *testing.T) {
|
|||
Client.Login(user1.Email, "passwd1")
|
||||
Client.SetTeamId(team.Id)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "TestGetPosts", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "TestGetPosts", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "search for post1"}
|
||||
|
|
|
|||
|
|
@ -1232,7 +1232,7 @@ func TestUserPermDelete(t *testing.T) {
|
|||
Client.Login(user1.Email, "passwd1")
|
||||
Client.SetTeamId(team.Id)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "TestGetPosts", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "TestGetPosts", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "search for post1"}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func TestCreatePost(t *testing.T) {
|
|||
_, resp = Client.CreatePost(post)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
post2 := &model.Post{ChannelId: th.BasicChannel2.Id, Message: "a" + model.NewId() + "a", CreateAt: 123}
|
||||
post2 := &model.Post{ChannelId: th.BasicChannel2.Id, Message: "zz" + model.NewId() + "a", CreateAt: 123}
|
||||
rpost2, resp := Client.CreatePost(post2)
|
||||
|
||||
if rpost2.CreateAt == post2.CreateAt {
|
||||
|
|
@ -123,7 +123,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
*utils.Cfg.ServiceSettings.AllowEditPost = model.ALLOW_EDIT_POST_ALWAYS
|
||||
utils.SetDefaultRolesBasedOnConfig()
|
||||
|
||||
post := &model.Post{ChannelId: channel.Id, Message: "a" + model.NewId() + "a"}
|
||||
post := &model.Post{ChannelId: channel.Id, Message: "zz" + model.NewId() + "a"}
|
||||
rpost, resp := Client.CreatePost(post)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ func TestUpdatePost(t *testing.T) {
|
|||
t.Fatal("Newly created post shouldn't have EditAt set")
|
||||
}
|
||||
|
||||
msg := "a" + model.NewId() + " update post"
|
||||
msg := "zz" + model.NewId() + " update post"
|
||||
rpost.Message = msg
|
||||
rupost, resp := Client.UpdatePost(rpost.Id, rpost)
|
||||
CheckNoError(t, resp)
|
||||
|
|
@ -156,11 +156,11 @@ func TestUpdatePost(t *testing.T) {
|
|||
t.Fatal("failed to updates")
|
||||
}
|
||||
|
||||
post2 := &model.Post{ChannelId: channel.Id, Message: "a" + model.NewId() + "a", Type: model.POST_JOIN_LEAVE}
|
||||
post2 := &model.Post{ChannelId: channel.Id, Message: "zz" + model.NewId() + "a", Type: model.POST_JOIN_LEAVE}
|
||||
rpost2, resp := Client.CreatePost(post2)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
up2 := &model.Post{Id: rpost2.Id, ChannelId: channel.Id, Message: "a" + model.NewId() + " update post 2"}
|
||||
up2 := &model.Post{Id: rpost2.Id, ChannelId: channel.Id, Message: "zz" + model.NewId() + " update post 2"}
|
||||
_, resp = Client.UpdatePost(rpost2.Id, up2)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ func TestGetPostsForChannel(t *testing.T) {
|
|||
|
||||
post1 := th.CreatePost()
|
||||
post2 := th.CreatePost()
|
||||
post3 := &model.Post{ChannelId: th.BasicChannel.Id, Message: "a" + model.NewId() + "a", RootId: post1.Id}
|
||||
post3 := &model.Post{ChannelId: th.BasicChannel.Id, Message: "zz" + model.NewId() + "a", RootId: post1.Id}
|
||||
post3, _ = Client.CreatePost(post3)
|
||||
|
||||
time := model.GetMillis()
|
||||
|
|
@ -803,7 +803,7 @@ func TestGetPostThread(t *testing.T) {
|
|||
defer TearDown()
|
||||
Client := th.Client
|
||||
|
||||
post := &model.Post{ChannelId: th.BasicChannel.Id, Message: "a" + model.NewId() + "a", RootId: th.BasicPost.Id}
|
||||
post := &model.Post{ChannelId: th.BasicChannel.Id, Message: "zz" + model.NewId() + "a", RootId: th.BasicPost.Id}
|
||||
post, _ = Client.CreatePost(post)
|
||||
|
||||
list, resp := Client.GetPostThread(th.BasicPost.Id, "")
|
||||
|
|
@ -1071,7 +1071,7 @@ func TestGetFileInfosForPost(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
post := &model.Post{ChannelId: th.BasicChannel.Id, Message: "a" + model.NewId() + "a", FileIds: fileIds}
|
||||
post := &model.Post{ChannelId: th.BasicChannel.Id, Message: "zz" + model.NewId() + "a", FileIds: fileIds}
|
||||
post, _ = Client.CreatePost(post)
|
||||
|
||||
infos, resp := Client.GetFileInfosForPost(post.Id, "")
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ func TestChannelStoreSave(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = teamId
|
||||
o1.DisplayName = "Name"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
|
||||
if err := (<-store.Channel().Save(&o1)).Err; err != nil {
|
||||
|
|
@ -35,7 +35,7 @@ func TestChannelStoreSave(t *testing.T) {
|
|||
}
|
||||
|
||||
o1.Id = ""
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_DIRECT
|
||||
if err := (<-store.Channel().Save(&o1)).Err; err == nil {
|
||||
t.Fatal("Should not be able to save direct channel")
|
||||
|
|
@ -50,7 +50,7 @@ func TestChannelStoreSaveDirectChannel(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = teamId
|
||||
o1.DisplayName = "Name"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_DIRECT
|
||||
|
||||
u1 := &model.User{}
|
||||
|
|
@ -106,7 +106,7 @@ func TestChannelStoreSaveDirectChannel(t *testing.T) {
|
|||
|
||||
// Attempt to save a non-direct channel
|
||||
o1.Id = ""
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
if err := (<-store.Channel().SaveDirectChannel(&o1, &m1, &m2)).Err; err == nil {
|
||||
t.Fatal("Should not be able to save non-direct channel")
|
||||
|
|
@ -147,14 +147,14 @@ func TestChannelStoreUpdate(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Name"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = o1.TeamId
|
||||
o2.DisplayName = "Name"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ func TestChannelStoreGet(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Name"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ func TestChannelStoreGet(t *testing.T) {
|
|||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Direct Name"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_DIRECT
|
||||
|
||||
m1 := model.ChannelMember{}
|
||||
|
|
@ -347,7 +347,7 @@ func TestChannelStoreGetForPost(t *testing.T) {
|
|||
o1 := Must(store.Channel().Save(&model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: "Name",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
})).(*model.Channel)
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ func TestSqlChannelStoreRestore(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
|
|
@ -398,28 +398,28 @@ func TestChannelStoreDelete(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = o1.TeamId
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
o3.DisplayName = "Channel3"
|
||||
o3.Name = "a" + model.NewId() + "b"
|
||||
o3.Name = "zz" + model.NewId() + "b"
|
||||
o3.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o3))
|
||||
|
||||
o4 := model.Channel{}
|
||||
o4.TeamId = o1.TeamId
|
||||
o4.DisplayName = "Channel4"
|
||||
o4.Name = "a" + model.NewId() + "b"
|
||||
o4.Name = "zz" + model.NewId() + "b"
|
||||
o4.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o4))
|
||||
|
||||
|
|
@ -480,7 +480,7 @@ func TestChannelStoreGetByName(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Name"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
|
|
@ -522,7 +522,7 @@ func TestChannelStoreGetDeletedByName(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Name"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
o1.DeleteAt = model.GetMillis()
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
|
@ -546,7 +546,7 @@ func TestChannelStoreGetDeleted(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
o1.DeleteAt = model.GetMillis()
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
|
@ -568,7 +568,7 @@ func TestChannelStoreGetDeleted(t *testing.T) {
|
|||
o2 := model.Channel{}
|
||||
o2.TeamId = o1.TeamId
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
|
|
@ -585,7 +585,7 @@ func TestChannelStoreGetDeleted(t *testing.T) {
|
|||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
o3.DisplayName = "Channel3"
|
||||
o3.Name = "a" + model.NewId() + "b"
|
||||
o3.Name = "zz" + model.NewId() + "b"
|
||||
o3.Type = model.CHANNEL_OPEN
|
||||
o3.DeleteAt = model.GetMillis()
|
||||
Must(store.Channel().Save(&o3))
|
||||
|
|
@ -628,7 +628,7 @@ func TestChannelMemberStore(t *testing.T) {
|
|||
c1 := model.Channel{}
|
||||
c1.TeamId = model.NewId()
|
||||
c1.DisplayName = "NameName"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
|
||||
|
||||
|
|
@ -725,7 +725,7 @@ func TestChannelDeleteMemberStore(t *testing.T) {
|
|||
c1 := model.Channel{}
|
||||
c1.TeamId = model.NewId()
|
||||
c1.DisplayName = "NameName"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
|
||||
|
||||
|
|
@ -791,14 +791,14 @@ func TestChannelStoreGetChannels(t *testing.T) {
|
|||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
|
|
@ -870,14 +870,14 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
|
|
@ -902,21 +902,21 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
|
|||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
o3.DisplayName = "ChannelA"
|
||||
o3.Name = "a" + model.NewId() + "b"
|
||||
o3.Name = "zz" + model.NewId() + "b"
|
||||
o3.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o3))
|
||||
|
||||
o4 := model.Channel{}
|
||||
o4.TeamId = o1.TeamId
|
||||
o4.DisplayName = "ChannelB"
|
||||
o4.Name = "a" + model.NewId() + "b"
|
||||
o4.Name = "zz" + model.NewId() + "b"
|
||||
o4.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o4))
|
||||
|
||||
o5 := model.Channel{}
|
||||
o5.TeamId = o1.TeamId
|
||||
o5.DisplayName = "ChannelC"
|
||||
o5.Name = "a" + model.NewId() + "b"
|
||||
o5.Name = "zz" + model.NewId() + "b"
|
||||
o5.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o5))
|
||||
|
||||
|
|
@ -937,7 +937,7 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
|
|||
o6 := model.Channel{}
|
||||
o6.TeamId = o1.TeamId
|
||||
o6.DisplayName = "ChannelA"
|
||||
o6.Name = "a" + model.NewId() + "b"
|
||||
o6.Name = "zz" + model.NewId() + "b"
|
||||
o6.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o6))
|
||||
|
||||
|
|
@ -987,21 +987,21 @@ func TestChannelStoreGetPublicChannelsForTeam(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "OpenChannel1Team1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "OpenChannel1Team2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
o3.DisplayName = "PrivateChannel1Team1"
|
||||
o3.Name = "a" + model.NewId() + "b"
|
||||
o3.Name = "zz" + model.NewId() + "b"
|
||||
o3.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o3))
|
||||
|
||||
|
|
@ -1022,7 +1022,7 @@ func TestChannelStoreGetPublicChannelsForTeam(t *testing.T) {
|
|||
o4 := model.Channel{}
|
||||
o4.TeamId = o1.TeamId
|
||||
o4.DisplayName = "OpenChannel2Team1"
|
||||
o4.Name = "a" + model.NewId() + "b"
|
||||
o4.Name = "zz" + model.NewId() + "b"
|
||||
o4.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o4))
|
||||
|
||||
|
|
@ -1074,21 +1074,21 @@ func TestChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T) {
|
|||
oc1 := model.Channel{}
|
||||
oc1.TeamId = teamId1
|
||||
oc1.DisplayName = "OpenChannel1Team1"
|
||||
oc1.Name = "a" + model.NewId() + "b"
|
||||
oc1.Name = "zz" + model.NewId() + "b"
|
||||
oc1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&oc1))
|
||||
|
||||
oc2 := model.Channel{}
|
||||
oc2.TeamId = model.NewId()
|
||||
oc2.DisplayName = "OpenChannel2TeamOther"
|
||||
oc2.Name = "a" + model.NewId() + "b"
|
||||
oc2.Name = "zz" + model.NewId() + "b"
|
||||
oc2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&oc2))
|
||||
|
||||
pc3 := model.Channel{}
|
||||
pc3.TeamId = teamId1
|
||||
pc3.DisplayName = "PrivateChannel3Team1"
|
||||
pc3.Name = "a" + model.NewId() + "b"
|
||||
pc3.Name = "zz" + model.NewId() + "b"
|
||||
pc3.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&pc3))
|
||||
|
||||
|
|
@ -1117,7 +1117,7 @@ func TestChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T) {
|
|||
oc4 := model.Channel{}
|
||||
oc4.TeamId = teamId1
|
||||
oc4.DisplayName = "OpenChannel4Team1"
|
||||
oc4.Name = "a" + model.NewId() + "b"
|
||||
oc4.Name = "zz" + model.NewId() + "b"
|
||||
oc4.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&oc4))
|
||||
|
||||
|
|
@ -1153,14 +1153,14 @@ func TestChannelStoreGetChannelCounts(t *testing.T) {
|
|||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
|
|
@ -1207,14 +1207,14 @@ func TestChannelStoreGetMembersForUser(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = t1.Id
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = o1.TeamId
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
|
|
@ -1245,7 +1245,7 @@ func TestChannelStoreUpdateLastViewedAt(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
o1.TotalMsgCount = 25
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
|
@ -1273,7 +1273,7 @@ func TestChannelStoreIncrementMentionCount(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
o1.TotalMsgCount = 25
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
|
@ -1422,7 +1422,7 @@ func TestChannelStoreGetMemberForPost(t *testing.T) {
|
|||
o1 := Must(store.Channel().Save(&model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: "Name",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
})).(*model.Channel)
|
||||
|
||||
|
|
@ -1457,7 +1457,7 @@ func TestGetMemberCount(t *testing.T) {
|
|||
c1 := model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel1",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
}
|
||||
Must(store.Channel().Save(&c1))
|
||||
|
|
@ -1465,7 +1465,7 @@ func TestGetMemberCount(t *testing.T) {
|
|||
c2 := model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel2",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
}
|
||||
Must(store.Channel().Save(&c2))
|
||||
|
|
@ -1561,7 +1561,7 @@ func TestUpdateExtrasByUser(t *testing.T) {
|
|||
c1 := model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel1",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
}
|
||||
Must(store.Channel().Save(&c1))
|
||||
|
|
@ -1569,7 +1569,7 @@ func TestUpdateExtrasByUser(t *testing.T) {
|
|||
c2 := model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel2",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
}
|
||||
Must(store.Channel().Save(&c2))
|
||||
|
|
@ -1609,14 +1609,14 @@ func TestChannelStoreSearchMore(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "ChannelA"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
|
|
@ -1641,21 +1641,21 @@ func TestChannelStoreSearchMore(t *testing.T) {
|
|||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
o3.DisplayName = "ChannelA"
|
||||
o3.Name = "a" + model.NewId() + "b"
|
||||
o3.Name = "zz" + model.NewId() + "b"
|
||||
o3.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o3))
|
||||
|
||||
o4 := model.Channel{}
|
||||
o4.TeamId = o1.TeamId
|
||||
o4.DisplayName = "ChannelB"
|
||||
o4.Name = "a" + model.NewId() + "b"
|
||||
o4.Name = "zz" + model.NewId() + "b"
|
||||
o4.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o4))
|
||||
|
||||
o5 := model.Channel{}
|
||||
o5.TeamId = o1.TeamId
|
||||
o5.DisplayName = "ChannelC"
|
||||
o5.Name = "a" + model.NewId() + "b"
|
||||
o5.Name = "zz" + model.NewId() + "b"
|
||||
o5.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o5))
|
||||
|
||||
|
|
@ -1702,14 +1702,14 @@ func TestChannelStoreSearchInTeam(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "ChannelA"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
|
|
@ -1734,21 +1734,21 @@ func TestChannelStoreSearchInTeam(t *testing.T) {
|
|||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
o3.DisplayName = "ChannelA"
|
||||
o3.Name = "a" + model.NewId() + "b"
|
||||
o3.Name = "zz" + model.NewId() + "b"
|
||||
o3.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o3))
|
||||
|
||||
o4 := model.Channel{}
|
||||
o4.TeamId = o1.TeamId
|
||||
o4.DisplayName = "ChannelB"
|
||||
o4.Name = "a" + model.NewId() + "b"
|
||||
o4.Name = "zz" + model.NewId() + "b"
|
||||
o4.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o4))
|
||||
|
||||
o5 := model.Channel{}
|
||||
o5.TeamId = o1.TeamId
|
||||
o5.DisplayName = "ChannelC"
|
||||
o5.Name = "a" + model.NewId() + "b"
|
||||
o5.Name = "zz" + model.NewId() + "b"
|
||||
o5.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&o5))
|
||||
|
||||
|
|
@ -1786,7 +1786,7 @@ func TestChannelStoreGetMembersByIds(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "ChannelA"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
|
|
@ -1831,21 +1831,21 @@ func TestChannelStoreAnalyticsDeletedTypeCount(t *testing.T) {
|
|||
o1 := model.Channel{}
|
||||
o1.TeamId = model.NewId()
|
||||
o1.DisplayName = "ChannelA"
|
||||
o1.Name = "a" + model.NewId() + "b"
|
||||
o1.Name = "zz" + model.NewId() + "b"
|
||||
o1.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o1))
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = model.NewId()
|
||||
o2.DisplayName = "Channel2"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Type = model.CHANNEL_OPEN
|
||||
Must(store.Channel().Save(&o2))
|
||||
|
||||
p3 := model.Channel{}
|
||||
p3.TeamId = model.NewId()
|
||||
p3.DisplayName = "Channel3"
|
||||
p3.Name = "a" + model.NewId() + "b"
|
||||
p3.Name = "zz" + model.NewId() + "b"
|
||||
p3.Type = model.CHANNEL_PRIVATE
|
||||
Must(store.Channel().Save(&p3))
|
||||
|
||||
|
|
@ -1923,7 +1923,7 @@ func TestChannelStoreGetPinnedPosts(t *testing.T) {
|
|||
o1 := Must(store.Channel().Save(&model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: "Name",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
})).(*model.Channel)
|
||||
|
||||
|
|
@ -1943,7 +1943,7 @@ func TestChannelStoreGetPinnedPosts(t *testing.T) {
|
|||
o2 := Must(store.Channel().Save(&model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: "Name",
|
||||
Name: "a" + model.NewId() + "b",
|
||||
Name: "zz" + model.NewId() + "b",
|
||||
Type: model.CHANNEL_OPEN,
|
||||
})).(*model.Channel)
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ func TestComplianceExport(t *testing.T) {
|
|||
|
||||
t1 := &model.Team{}
|
||||
t1.DisplayName = "DisplayName"
|
||||
t1.Name = "a" + model.NewId() + "b"
|
||||
t1.Name = "zz" + model.NewId() + "b"
|
||||
t1.Email = model.NewId() + "@nowhere.com"
|
||||
t1.Type = model.TEAM_OPEN
|
||||
t1 = Must(store.Team().Save(t1)).(*model.Team)
|
||||
|
|
@ -88,7 +88,7 @@ func TestComplianceExport(t *testing.T) {
|
|||
c1 := &model.Channel{}
|
||||
c1.TeamId = t1.Id
|
||||
c1.DisplayName = "Channel2"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = Must(store.Channel().Save(c1)).(*model.Channel)
|
||||
|
||||
|
|
@ -96,28 +96,28 @@ func TestComplianceExport(t *testing.T) {
|
|||
o1.ChannelId = c1.Id
|
||||
o1.UserId = u1.Id
|
||||
o1.CreateAt = model.GetMillis()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = Must(store.Post().Save(o1)).(*model.Post)
|
||||
|
||||
o1a := &model.Post{}
|
||||
o1a.ChannelId = c1.Id
|
||||
o1a.UserId = u1.Id
|
||||
o1a.CreateAt = o1.CreateAt + 10
|
||||
o1a.Message = "a" + model.NewId() + "b"
|
||||
o1a.Message = "zz" + model.NewId() + "b"
|
||||
o1a = Must(store.Post().Save(o1a)).(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = c1.Id
|
||||
o2.UserId = u1.Id
|
||||
o2.CreateAt = o1.CreateAt + 20
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2 = Must(store.Post().Save(o2)).(*model.Post)
|
||||
|
||||
o2a := &model.Post{}
|
||||
o2a.ChannelId = c1.Id
|
||||
o2a.UserId = u2.Id
|
||||
o2a.CreateAt = o1.CreateAt + 30
|
||||
o2a.Message = "a" + model.NewId() + "b"
|
||||
o2a.Message = "zz" + model.NewId() + "b"
|
||||
o2a = Must(store.Post().Save(o2a)).(*model.Post)
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func TestPostStoreSave(t *testing.T) {
|
|||
o1 := model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
|
||||
if err := (<-store.Post().Save(&o1)).Err; err != nil {
|
||||
t.Fatal("couldn't save item", err)
|
||||
|
|
@ -36,7 +36,7 @@ func TestPostStoreGet(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
|
||||
etag1 := (<-store.Post().GetEtag(o1.ChannelId, false)).Data.(string)
|
||||
if strings.Index(etag1, model.CurrentVersion+".") != 0 {
|
||||
|
|
@ -73,7 +73,7 @@ func TestPostStoreGetSingle(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ func TestGetEtagCache(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
|
||||
etag1 := (<-store.Post().GetEtag(o1.ChannelId, true)).Data.(string)
|
||||
if strings.Index(etag1, model.CurrentVersion+".") != 0 {
|
||||
|
|
@ -131,13 +131,13 @@ func TestPostStoreUpdate(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "AAAAAAAAAAA"
|
||||
o1.Message = "zz" + model.NewId() + "AAAAAAAAAAA"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "CCCCCCCCC"
|
||||
o2.Message = "zz" + model.NewId() + "CCCCCCCCC"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -145,7 +145,7 @@ func TestPostStoreUpdate(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "QQQQQQQQQQ"
|
||||
o3.Message = "zz" + model.NewId() + "QQQQQQQQQQ"
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
||||
ro1 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id]
|
||||
|
|
@ -225,7 +225,7 @@ func TestPostStoreDelete(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
|
||||
etag1 := (<-store.Post().GetEtag(o1.ChannelId, false)).Data.(string)
|
||||
if strings.Index(etag1, model.CurrentVersion+".") != 0 {
|
||||
|
|
@ -263,13 +263,13 @@ func TestPostStoreDelete1Level(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -293,13 +293,13 @@ func TestPostStoreDelete2Level(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -307,7 +307,7 @@ func TestPostStoreDelete2Level(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.ParentId = o2.Id
|
||||
o3.RootId = o1.Id
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
|
@ -315,7 +315,7 @@ func TestPostStoreDelete2Level(t *testing.T) {
|
|||
o4 := &model.Post{}
|
||||
o4.ChannelId = model.NewId()
|
||||
o4.UserId = model.NewId()
|
||||
o4.Message = "a" + model.NewId() + "b"
|
||||
o4.Message = "zz" + model.NewId() + "b"
|
||||
o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
|
||||
|
||||
if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil {
|
||||
|
|
@ -345,13 +345,13 @@ func TestPostStorePermDelete1Level(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -359,7 +359,7 @@ func TestPostStorePermDelete1Level(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = model.NewId()
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
||||
if r2 := <-store.Post().PermanentDeleteByUser(o2.UserId); r2.Err != nil {
|
||||
|
|
@ -389,13 +389,13 @@ func TestPostStorePermDelete1Level2(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -403,7 +403,7 @@ func TestPostStorePermDelete1Level2(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = model.NewId()
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
||||
if r2 := <-store.Post().PermanentDeleteByUser(o1.UserId); r2.Err != nil {
|
||||
|
|
@ -429,13 +429,13 @@ func TestPostStoreGetWithChildren(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -443,7 +443,7 @@ func TestPostStoreGetWithChildren(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.ParentId = o2.Id
|
||||
o3.RootId = o1.Id
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
|
@ -486,14 +486,14 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -502,7 +502,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
|
|||
o2a := &model.Post{}
|
||||
o2a.ChannelId = o1.ChannelId
|
||||
o2a.UserId = model.NewId()
|
||||
o2a.Message = "a" + model.NewId() + "b"
|
||||
o2a.Message = "zz" + model.NewId() + "b"
|
||||
o2a.ParentId = o1.Id
|
||||
o2a.RootId = o1.Id
|
||||
o2a = (<-store.Post().Save(o2a)).Data.(*model.Post)
|
||||
|
|
@ -511,7 +511,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.ParentId = o1.Id
|
||||
o3.RootId = o1.Id
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
|
@ -520,14 +520,14 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
|
|||
o4 := &model.Post{}
|
||||
o4.ChannelId = o1.ChannelId
|
||||
o4.UserId = model.NewId()
|
||||
o4.Message = "a" + model.NewId() + "b"
|
||||
o4.Message = "zz" + model.NewId() + "b"
|
||||
o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o5 := &model.Post{}
|
||||
o5.ChannelId = o1.ChannelId
|
||||
o5.UserId = model.NewId()
|
||||
o5.Message = "a" + model.NewId() + "b"
|
||||
o5.Message = "zz" + model.NewId() + "b"
|
||||
o5.ParentId = o4.Id
|
||||
o5.RootId = o4.Id
|
||||
o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
|
||||
|
|
@ -590,21 +590,21 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
|
|||
o0 := &model.Post{}
|
||||
o0.ChannelId = model.NewId()
|
||||
o0.UserId = model.NewId()
|
||||
o0.Message = "a" + model.NewId() + "b"
|
||||
o0.Message = "zz" + model.NewId() + "b"
|
||||
o0 = (<-store.Post().Save(o0)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -613,7 +613,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
|
|||
o2a := &model.Post{}
|
||||
o2a.ChannelId = o1.ChannelId
|
||||
o2a.UserId = model.NewId()
|
||||
o2a.Message = "a" + model.NewId() + "b"
|
||||
o2a.Message = "zz" + model.NewId() + "b"
|
||||
o2a.ParentId = o1.Id
|
||||
o2a.RootId = o1.Id
|
||||
o2a = (<-store.Post().Save(o2a)).Data.(*model.Post)
|
||||
|
|
@ -622,7 +622,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.ParentId = o1.Id
|
||||
o3.RootId = o1.Id
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
|
@ -631,14 +631,14 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
|
|||
o4 := &model.Post{}
|
||||
o4.ChannelId = o1.ChannelId
|
||||
o4.UserId = model.NewId()
|
||||
o4.Message = "a" + model.NewId() + "b"
|
||||
o4.Message = "zz" + model.NewId() + "b"
|
||||
o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o5 := &model.Post{}
|
||||
o5.ChannelId = o1.ChannelId
|
||||
o5.UserId = model.NewId()
|
||||
o5.Message = "a" + model.NewId() + "b"
|
||||
o5.Message = "zz" + model.NewId() + "b"
|
||||
o5.ParentId = o4.Id
|
||||
o5.RootId = o4.Id
|
||||
o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
|
||||
|
|
@ -695,21 +695,21 @@ func TestPostStoreGetPostsSince(t *testing.T) {
|
|||
o0 := &model.Post{}
|
||||
o0.ChannelId = model.NewId()
|
||||
o0.UserId = model.NewId()
|
||||
o0.Message = "a" + model.NewId() + "b"
|
||||
o0.Message = "zz" + model.NewId() + "b"
|
||||
o0 = (<-store.Post().Save(o0)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -718,7 +718,7 @@ func TestPostStoreGetPostsSince(t *testing.T) {
|
|||
o2a := &model.Post{}
|
||||
o2a.ChannelId = o1.ChannelId
|
||||
o2a.UserId = model.NewId()
|
||||
o2a.Message = "a" + model.NewId() + "b"
|
||||
o2a.Message = "zz" + model.NewId() + "b"
|
||||
o2a.ParentId = o1.Id
|
||||
o2a.RootId = o1.Id
|
||||
o2a = (<-store.Post().Save(o2a)).Data.(*model.Post)
|
||||
|
|
@ -727,7 +727,7 @@ func TestPostStoreGetPostsSince(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.ParentId = o1.Id
|
||||
o3.RootId = o1.Id
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
|
@ -736,14 +736,14 @@ func TestPostStoreGetPostsSince(t *testing.T) {
|
|||
o4 := &model.Post{}
|
||||
o4.ChannelId = o1.ChannelId
|
||||
o4.UserId = model.NewId()
|
||||
o4.Message = "a" + model.NewId() + "b"
|
||||
o4.Message = "zz" + model.NewId() + "b"
|
||||
o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o5 := &model.Post{}
|
||||
o5.ChannelId = o1.ChannelId
|
||||
o5.UserId = model.NewId()
|
||||
o5.Message = "a" + model.NewId() + "b"
|
||||
o5.Message = "zz" + model.NewId() + "b"
|
||||
o5.ParentId = o4.Id
|
||||
o5.RootId = o4.Id
|
||||
o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
|
||||
|
|
@ -790,7 +790,7 @@ func TestPostStoreSearch(t *testing.T) {
|
|||
c1 := &model.Channel{}
|
||||
c1.TeamId = teamId
|
||||
c1.DisplayName = "Channel1"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = (<-store.Channel().Save(c1)).Data.(*model.Channel)
|
||||
|
||||
|
|
@ -803,7 +803,7 @@ func TestPostStoreSearch(t *testing.T) {
|
|||
c2 := &model.Channel{}
|
||||
c2.TeamId = teamId
|
||||
c2.DisplayName = "Channel1"
|
||||
c2.Name = "a" + model.NewId() + "b"
|
||||
c2.Name = "zz" + model.NewId() + "b"
|
||||
c2.Type = model.CHANNEL_OPEN
|
||||
c2 = (<-store.Channel().Save(c2)).Data.(*model.Channel)
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
|
|||
|
||||
t1 := &model.Team{}
|
||||
t1.DisplayName = "DisplayName"
|
||||
t1.Name = "a" + model.NewId() + "b"
|
||||
t1.Name = "zz" + model.NewId() + "b"
|
||||
t1.Email = model.NewId() + "@nowhere.com"
|
||||
t1.Type = model.TEAM_OPEN
|
||||
t1 = Must(store.Team().Save(t1)).(*model.Team)
|
||||
|
|
@ -924,7 +924,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
|
|||
c1 := &model.Channel{}
|
||||
c1.TeamId = t1.Id
|
||||
c1.DisplayName = "Channel2"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = Must(store.Channel().Save(c1)).(*model.Channel)
|
||||
|
||||
|
|
@ -932,28 +932,28 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
|
|||
o1.ChannelId = c1.Id
|
||||
o1.UserId = model.NewId()
|
||||
o1.CreateAt = utils.MillisFromTime(utils.Yesterday())
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = Must(store.Post().Save(o1)).(*model.Post)
|
||||
|
||||
o1a := &model.Post{}
|
||||
o1a.ChannelId = c1.Id
|
||||
o1a.UserId = model.NewId()
|
||||
o1a.CreateAt = o1.CreateAt
|
||||
o1a.Message = "a" + model.NewId() + "b"
|
||||
o1a.Message = "zz" + model.NewId() + "b"
|
||||
o1a = Must(store.Post().Save(o1a)).(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = c1.Id
|
||||
o2.UserId = model.NewId()
|
||||
o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24)
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2 = Must(store.Post().Save(o2)).(*model.Post)
|
||||
|
||||
o2a := &model.Post{}
|
||||
o2a.ChannelId = c1.Id
|
||||
o2a.UserId = o2.UserId
|
||||
o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24)
|
||||
o2a.Message = "a" + model.NewId() + "b"
|
||||
o2a.Message = "zz" + model.NewId() + "b"
|
||||
o2a = Must(store.Post().Save(o2a)).(*model.Post)
|
||||
|
||||
if r1 := <-store.Post().AnalyticsUserCountsWithPostsByDay(t1.Id); r1.Err != nil {
|
||||
|
|
@ -976,7 +976,7 @@ func TestPostCountsByDay(t *testing.T) {
|
|||
|
||||
t1 := &model.Team{}
|
||||
t1.DisplayName = "DisplayName"
|
||||
t1.Name = "a" + model.NewId() + "b"
|
||||
t1.Name = "zz" + model.NewId() + "b"
|
||||
t1.Email = model.NewId() + "@nowhere.com"
|
||||
t1.Type = model.TEAM_OPEN
|
||||
t1 = Must(store.Team().Save(t1)).(*model.Team)
|
||||
|
|
@ -984,7 +984,7 @@ func TestPostCountsByDay(t *testing.T) {
|
|||
c1 := &model.Channel{}
|
||||
c1.TeamId = t1.Id
|
||||
c1.DisplayName = "Channel2"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = Must(store.Channel().Save(c1)).(*model.Channel)
|
||||
|
||||
|
|
@ -992,28 +992,28 @@ func TestPostCountsByDay(t *testing.T) {
|
|||
o1.ChannelId = c1.Id
|
||||
o1.UserId = model.NewId()
|
||||
o1.CreateAt = utils.MillisFromTime(utils.Yesterday())
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = Must(store.Post().Save(o1)).(*model.Post)
|
||||
|
||||
o1a := &model.Post{}
|
||||
o1a.ChannelId = c1.Id
|
||||
o1a.UserId = model.NewId()
|
||||
o1a.CreateAt = o1.CreateAt
|
||||
o1a.Message = "a" + model.NewId() + "b"
|
||||
o1a.Message = "zz" + model.NewId() + "b"
|
||||
o1a = Must(store.Post().Save(o1a)).(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = c1.Id
|
||||
o2.UserId = model.NewId()
|
||||
o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2)
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2 = Must(store.Post().Save(o2)).(*model.Post)
|
||||
|
||||
o2a := &model.Post{}
|
||||
o2a.ChannelId = c1.Id
|
||||
o2a.UserId = o2.UserId
|
||||
o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2)
|
||||
o2a.Message = "a" + model.NewId() + "b"
|
||||
o2a.Message = "zz" + model.NewId() + "b"
|
||||
o2a = Must(store.Post().Save(o2a)).(*model.Post)
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
|
@ -1047,28 +1047,28 @@ func TestPostStoreGetFlaggedPostsForTeam(t *testing.T) {
|
|||
c1 := &model.Channel{}
|
||||
c1.TeamId = model.NewId()
|
||||
c1.DisplayName = "Channel1"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = Must(store.Channel().Save(c1)).(*model.Channel)
|
||||
|
||||
o1 := &model.Post{}
|
||||
o1.ChannelId = c1.Id
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.DeleteAt = 1
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
|
@ -1076,13 +1076,13 @@ func TestPostStoreGetFlaggedPostsForTeam(t *testing.T) {
|
|||
o4 := &model.Post{}
|
||||
o4.ChannelId = model.NewId()
|
||||
o4.UserId = model.NewId()
|
||||
o4.Message = "a" + model.NewId() + "b"
|
||||
o4.Message = "zz" + model.NewId() + "b"
|
||||
o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
c2 := &model.Channel{}
|
||||
c2.DisplayName = "DMChannel1"
|
||||
c2.Name = "a" + model.NewId() + "b"
|
||||
c2.Name = "zz" + model.NewId() + "b"
|
||||
c2.Type = model.CHANNEL_DIRECT
|
||||
|
||||
m1 := &model.ChannelMember{}
|
||||
|
|
@ -1100,7 +1100,7 @@ func TestPostStoreGetFlaggedPostsForTeam(t *testing.T) {
|
|||
o5 := &model.Post{}
|
||||
o5.ChannelId = c2.Id
|
||||
o5.UserId = m2.UserId
|
||||
o5.Message = "a" + model.NewId() + "b"
|
||||
o5.Message = "zz" + model.NewId() + "b"
|
||||
o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
|
|
@ -1224,21 +1224,21 @@ func TestPostStoreGetFlaggedPosts(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.DeleteAt = 1
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
|
@ -1325,14 +1325,14 @@ func TestPostStoreGetFlaggedPostsForChannel(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
|
|
@ -1340,7 +1340,7 @@ func TestPostStoreGetFlaggedPostsForChannel(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = model.NewId()
|
||||
o3.UserId = o1.ChannelId
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.DeleteAt = 1
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
|
@ -1348,7 +1348,7 @@ func TestPostStoreGetFlaggedPostsForChannel(t *testing.T) {
|
|||
o4 := &model.Post{}
|
||||
o4.ChannelId = model.NewId()
|
||||
o4.UserId = model.NewId()
|
||||
o4.Message = "a" + model.NewId() + "b"
|
||||
o4.Message = "zz" + model.NewId() + "b"
|
||||
o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
|
|
@ -1421,14 +1421,14 @@ func TestPostStoreGetPostsCreatedAt(t *testing.T) {
|
|||
o0 := &model.Post{}
|
||||
o0.ChannelId = model.NewId()
|
||||
o0.UserId = model.NewId()
|
||||
o0.Message = "a" + model.NewId() + "b"
|
||||
o0.Message = "zz" + model.NewId() + "b"
|
||||
o0.CreateAt = createTime
|
||||
o0 = (<-store.Post().Save(o0)).Data.(*model.Post)
|
||||
|
||||
o1 := &model.Post{}
|
||||
o1.ChannelId = o0.Id
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
o1.Message = "zz" + model.NewId() + "b"
|
||||
o0.CreateAt = createTime
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
|
@ -1436,7 +1436,7 @@ func TestPostStoreGetPostsCreatedAt(t *testing.T) {
|
|||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "b"
|
||||
o2.Message = "zz" + model.NewId() + "b"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -1445,7 +1445,7 @@ func TestPostStoreGetPostsCreatedAt(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = model.NewId()
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "b"
|
||||
o3.Message = "zz" + model.NewId() + "b"
|
||||
o3.CreateAt = createTime
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
|
@ -1463,13 +1463,13 @@ func TestPostStoreOverwrite(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "AAAAAAAAAAA"
|
||||
o1.Message = "zz" + model.NewId() + "AAAAAAAAAAA"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "CCCCCCCCC"
|
||||
o2.Message = "zz" + model.NewId() + "CCCCCCCCC"
|
||||
o2.ParentId = o1.Id
|
||||
o2.RootId = o1.Id
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
|
@ -1477,7 +1477,7 @@ func TestPostStoreOverwrite(t *testing.T) {
|
|||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "QQQQQQQQQQ"
|
||||
o3.Message = "zz" + model.NewId() + "QQQQQQQQQQ"
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
||||
ro1 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id]
|
||||
|
|
@ -1557,19 +1557,19 @@ func TestPostStoreGetPostsByIds(t *testing.T) {
|
|||
o1 := &model.Post{}
|
||||
o1.ChannelId = model.NewId()
|
||||
o1.UserId = model.NewId()
|
||||
o1.Message = "a" + model.NewId() + "AAAAAAAAAAA"
|
||||
o1.Message = "zz" + model.NewId() + "AAAAAAAAAAA"
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
o2 := &model.Post{}
|
||||
o2.ChannelId = o1.ChannelId
|
||||
o2.UserId = model.NewId()
|
||||
o2.Message = "a" + model.NewId() + "CCCCCCCCC"
|
||||
o2.Message = "zz" + model.NewId() + "CCCCCCCCC"
|
||||
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
|
||||
|
||||
o3 := &model.Post{}
|
||||
o3.ChannelId = o1.ChannelId
|
||||
o3.UserId = model.NewId()
|
||||
o3.Message = "a" + model.NewId() + "QQQQQQQQQQ"
|
||||
o3.Message = "zz" + model.NewId() + "QQQQQQQQQQ"
|
||||
o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
|
||||
|
||||
ro1 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id]
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ func TestTeamStoreSearchAll(t *testing.T) {
|
|||
|
||||
o1 := model.Team{}
|
||||
o1.DisplayName = "ADisplayName" + model.NewId()
|
||||
o1.Name = "a" + model.NewId() + "a"
|
||||
o1.Name = "zz" + model.NewId() + "a"
|
||||
o1.Email = model.NewId() + "@nowhere.com"
|
||||
o1.Type = model.TEAM_OPEN
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ func TestTeamStoreSearchOpen(t *testing.T) {
|
|||
|
||||
o1 := model.Team{}
|
||||
o1.DisplayName = "ADisplayName" + model.NewId()
|
||||
o1.Name = "a" + model.NewId() + "a"
|
||||
o1.Name = "zz" + model.NewId() + "a"
|
||||
o1.Email = model.NewId() + "@nowhere.com"
|
||||
o1.Type = model.TEAM_OPEN
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ func TestTeamStoreGetByIniviteId(t *testing.T) {
|
|||
|
||||
o2 := model.Team{}
|
||||
o2.DisplayName = "DisplayName"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Email = model.NewId() + "@nowhere.com"
|
||||
o2.Type = model.TEAM_OPEN
|
||||
|
||||
|
|
@ -371,7 +371,7 @@ func TestAllTeamListing(t *testing.T) {
|
|||
|
||||
o2 := model.Team{}
|
||||
o2.DisplayName = "DisplayName"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Email = model.NewId() + "@nowhere.com"
|
||||
o2.Type = model.TEAM_OPEN
|
||||
Must(store.Team().Save(&o2))
|
||||
|
|
@ -400,7 +400,7 @@ func TestDelete(t *testing.T) {
|
|||
|
||||
o2 := model.Team{}
|
||||
o2.DisplayName = "DisplayName"
|
||||
o2.Name = "a" + model.NewId() + "b"
|
||||
o2.Name = "zz" + model.NewId() + "b"
|
||||
o2.Email = model.NewId() + "@nowhere.com"
|
||||
o2.Type = model.TEAM_OPEN
|
||||
Must(store.Team().Save(&o2))
|
||||
|
|
|
|||
|
|
@ -1501,7 +1501,7 @@ func TestUserStoreSearch(t *testing.T) {
|
|||
c1 := model.Channel{}
|
||||
c1.TeamId = tid
|
||||
c1.DisplayName = "NameName"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ func TestIncomingWebhook(t *testing.T) {
|
|||
app.UpdateUserRoles(user.Id, model.ROLE_SYSTEM_ADMIN.Id)
|
||||
ApiClient.SetTeamId(team.Id)
|
||||
|
||||
channel1 := &model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 := &model.Channel{DisplayName: "Test API Name", Name: "zz" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = ApiClient.Must(ApiClient.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
if utils.Cfg.ServiceSettings.EnableIncomingWebhooks {
|
||||
|
|
|
|||
Loading…
Reference in a new issue