summaryrefslogtreecommitdiffstats
path: root/api4/channel_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2018-07-07 12:04:18 -0400
committerJoramWilander <jwawilander@gmail.com>2018-07-07 12:04:18 -0400
commitb78b216a3c8eb354085f97f33dac5e7661ac9188 (patch)
treedc7a253730a684bc6744c0b0bf36a87944242583 /api4/channel_test.go
parent359f12db33d45b6ffade0872ddf3652a5c52f4a8 (diff)
parent9e5ec7d09d4c51e278f17f25fb6c0f3484b50a3b (diff)
downloadchat-b78b216a3c8eb354085f97f33dac5e7661ac9188.tar.gz
chat-b78b216a3c8eb354085f97f33dac5e7661ac9188.tar.bz2
chat-b78b216a3c8eb354085f97f33dac5e7661ac9188.zip
Merge branch 'master' into plugins-2
Diffstat (limited to 'api4/channel_test.go')
-rw-r--r--api4/channel_test.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/api4/channel_test.go b/api4/channel_test.go
index 07077fb0c..40fd25ffd 100644
--- a/api4/channel_test.go
+++ b/api4/channel_test.go
@@ -16,6 +16,7 @@ import (
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
func TestCreateChannel(t *testing.T) {
@@ -320,6 +321,23 @@ func TestCreateDirectChannel(t *testing.T) {
CheckNoError(t, resp)
}
+func TestDeleteDirectChannel(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer th.TearDown()
+ Client := th.Client
+ user := th.BasicUser
+ user2 := th.BasicUser2
+
+ rgc, resp := Client.CreateDirectChannel(user.Id, user2.Id)
+ CheckNoError(t, resp)
+ CheckCreatedStatus(t, resp)
+ require.NotNil(t, rgc, "should have created a direct channel")
+
+ deleted, resp := Client.DeleteChannel(rgc.Id)
+ CheckErrorMessage(t, resp, "api.channel.delete_channel.type.invalid")
+ require.False(t, deleted, "should not have been able to delete direct channel.")
+}
+
func TestCreateGroupChannel(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer th.TearDown()
@@ -392,6 +410,26 @@ func TestCreateGroupChannel(t *testing.T) {
CheckNoError(t, resp)
}
+func TestDeleteGroupChannel(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer th.TearDown()
+ Client := th.Client
+ user := th.BasicUser
+ user2 := th.BasicUser2
+ user3 := th.CreateUser()
+
+ userIds := []string{user.Id, user2.Id, user3.Id}
+
+ rgc, resp := Client.CreateGroupChannel(userIds)
+ CheckNoError(t, resp)
+ CheckCreatedStatus(t, resp)
+ require.NotNil(t, rgc, "should have created a group channel")
+
+ deleted, resp := Client.DeleteChannel(rgc.Id)
+ CheckErrorMessage(t, resp, "api.channel.delete_channel.type.invalid")
+ require.False(t, deleted, "should not have been able to delete group channel.")
+}
+
func TestGetChannel(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer th.TearDown()