summaryrefslogtreecommitdiffstats
path: root/api/channel_test.go
diff options
context:
space:
mode:
authorNick Frazier <nrflaw@gmail.com>2016-12-20 08:56:45 -0500
committerChristopher Speller <crspeller@gmail.com>2016-12-20 08:56:45 -0500
commite9a1a8d3d9ee9a952f5552fc708b0e3830b21dd1 (patch)
tree58d5cffcc37c14d38bda4becd324909f838aefef /api/channel_test.go
parentfad14e6624d229b41283227e987f2362ef1d5af5 (diff)
downloadchat-e9a1a8d3d9ee9a952f5552fc708b0e3830b21dd1.tar.gz
chat-e9a1a8d3d9ee9a952f5552fc708b0e3830b21dd1.tar.bz2
chat-e9a1a8d3d9ee9a952f5552fc708b0e3830b21dd1.zip
GH-4685 Post a System Message when channel is renamed (#4762)
* test changes * added system message when displayname changed * added test * gofmt
Diffstat (limited to 'api/channel_test.go')
-rw-r--r--api/channel_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/api/channel_test.go b/api/channel_test.go
index 11914414b..25e7b6a28 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -370,6 +370,32 @@ func TestUpdateChannel(t *testing.T) {
}
}
+func TestUpdateChannelDisplayName(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ Client := th.SystemAdminClient
+ team := th.SystemAdminTeam
+ user := th.CreateUser(Client)
+ LinkUserToTeam(user, team)
+
+ 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 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
+
+ Client.AddChannelMember(channel1.Id, user.Id)
+
+ newDisplayName := "a" + channel1.DisplayName + "a"
+ channel1.DisplayName = newDisplayName
+ channel1 = Client.Must(Client.UpdateChannel(channel1)).Data.(*model.Channel)
+
+ time.Sleep(100 * time.Millisecond)
+
+ r1 := Client.Must(Client.GetPosts(channel1.Id, 0, 1, "")).Data.(*model.PostList)
+ if len(r1.Order) != 1 {
+ t.Fatal("Displayname update system message was not found")
+ }
+}
+
func TestUpdateChannelHeader(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
Client := th.BasicClient