Этот коммит содержится в:
Corey Hulen
2017-06-19 09:08:52 -07:00
коммит произвёл GitHub
родитель 36f216cb7c
Коммит e2cc0df2e8
11 изменённых файлов: 284 добавлений и 284 удалений

Просмотреть файл

@@ -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,
}

Просмотреть файл

@@ -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"}