summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/cli_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/api/cli_test.go b/api/cli_test.go
index 4b2500ad4..65afc81e9 100644
--- a/api/cli_test.go
+++ b/api/cli_test.go
@@ -389,3 +389,31 @@ func TestCliResetPassword(t *testing.T) {
th.BasicUser.Password = "password2"
th.LoginBasic()
}
+
+func TestCliCreateChannel(t *testing.T) {
+ if disableCliTests {
+ return
+ }
+
+ th := Setup().InitBasic()
+
+ id := model.NewId()
+ name := "name" + id
+
+ // should fail because channel does not have license
+ cmd := exec.Command("bash", "-c", `go run ../mattermost.go -create_channel -email="`+th.BasicUser.Email+`" -team_name="`+th.BasicTeam.Name+`" -channel_type="O" -channel_name="`+name+`"`)
+ output, err := cmd.CombinedOutput()
+ if err == nil {
+ t.Log(string(output))
+ t.Fatal()
+ }
+
+ // should fail because channel does not have license
+ name = name + "-private"
+ cmd2 := exec.Command("bash", "-c", `go run ../mattermost.go -create_channel -email="`+th.BasicUser.Email+`" -team_name="`+th.BasicTeam.Name+`" -channel_type="P" -channel_name="`+name+`"`)
+ output2, err2 := cmd2.CombinedOutput()
+ if err2 == nil {
+ t.Log(string(output2))
+ t.Fatal()
+ }
+}