summaryrefslogtreecommitdiffstats
path: root/api/cli_test.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-08-12 06:50:11 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-08-12 07:50:11 -0400
commit53c068952cd11b2997ba706ec0d921c5be4d9f26 (patch)
tree5d48c5a619979a8dbe1caacb16f7103a217802b6 /api/cli_test.go
parentc0a905c0376014763f851405032d2ae5440b45da (diff)
downloadchat-53c068952cd11b2997ba706ec0d921c5be4d9f26.tar.gz
chat-53c068952cd11b2997ba706ec0d921c5be4d9f26.tar.bz2
chat-53c068952cd11b2997ba706ec0d921c5be4d9f26.zip
EE: PLT-3747 Add create_channel to command line (#3760)
* PLT-3747 Add create_channel command line * Added tests * Set as EE feature
Diffstat (limited to 'api/cli_test.go')
-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()
+ }
+}