diff options
Diffstat (limited to 'api4/channel_test.go')
-rw-r--r-- | api4/channel_test.go | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/api4/channel_test.go b/api4/channel_test.go index c5deda83e..50755fbe0 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api4 @@ -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() |