From e9a1a8d3d9ee9a952f5552fc708b0e3830b21dd1 Mon Sep 17 00:00:00 2001 From: Nick Frazier Date: Tue, 20 Dec 2016 08:56:45 -0500 Subject: GH-4685 Post a System Message when channel is renamed (#4762) * test changes * added system message when displayname changed * added test * gofmt --- api/channel_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'api/channel_test.go') 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 -- cgit v1.2.3-1-g7c22