From 5986c4a847251e913e4cda3360677e4d0ac1d3f7 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Wed, 5 Apr 2017 16:41:33 +0100 Subject: [PATCH] PLT-4858: Unit tests to cover this bug. (#5990) --- api4/channel_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/api4/channel_test.go b/api4/channel_test.go index c5deda83e6..1c00c84501 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -715,6 +715,30 @@ func TestDeleteChannel(t *testing.T) { t.Fatal("should have failed") } + // check system admin can delete a channel without any appropriate team or channel membership. + sdTeam := th.CreateTeamWithClient(Client) + sdPublicChannel := &model.Channel{ + DisplayName: "dn_" + model.NewId(), + Name: GenerateTestChannelName(), + Type: model.CHANNEL_OPEN, + TeamId: sdTeam.Id, + } + sdPublicChannel, resp = Client.CreateChannel(sdPublicChannel) + CheckNoError(t, resp) + _, resp = th.SystemAdminClient.DeleteChannel(sdPublicChannel.Id) + CheckNoError(t, resp) + + sdPrivateChannel := &model.Channel{ + DisplayName: "dn_" + model.NewId(), + Name: GenerateTestChannelName(), + Type: model.CHANNEL_PRIVATE, + TeamId: sdTeam.Id, + } + sdPrivateChannel, resp = Client.CreateChannel(sdPrivateChannel) + CheckNoError(t, resp) + _, resp = th.SystemAdminClient.DeleteChannel(sdPrivateChannel.Id) + CheckNoError(t, resp) + th.LoginBasic() publicChannel5 := th.CreatePublicChannel() Client.Logout()