summaryrefslogtreecommitdiffstats
path: root/cmd/mattermost
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-05-18 08:41:44 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-05-18 08:41:44 -0400
commitc6ba5c32d62f8c1fd0e0669a3df0c844ec794590 (patch)
tree174ae1b3b93f8027ae7d8796b13de089f32c9bd4 /cmd/mattermost
parent78d95a25f799f818de03e9aa58a131407b6c122f (diff)
downloadchat-c6ba5c32d62f8c1fd0e0669a3df0c844ec794590.tar.gz
chat-c6ba5c32d62f8c1fd0e0669a3df0c844ec794590.tar.bz2
chat-c6ba5c32d62f8c1fd0e0669a3df0c844ec794590.zip
Merge fix.
Diffstat (limited to 'cmd/mattermost')
-rw-r--r--cmd/mattermost/commands/permissions_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/mattermost/commands/permissions_test.go b/cmd/mattermost/commands/permissions_test.go
new file mode 100644
index 000000000..eeaa17109
--- /dev/null
+++ b/cmd/mattermost/commands/permissions_test.go
@@ -0,0 +1,40 @@
+// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package commands
+
+import (
+ "os"
+ "os/exec"
+ "strings"
+ "testing"
+
+ "github.com/mattermost/mattermost-server/api4"
+ "github.com/mattermost/mattermost-server/utils"
+)
+
+func TestPermissionsExport_rejectsUnlicensed(t *testing.T) {
+ permissionsLicenseRequiredTest(t, "export")
+}
+
+func TestPermissionsImport_rejectsUnlicensed(t *testing.T) {
+ permissionsLicenseRequiredTest(t, "import")
+}
+
+func permissionsLicenseRequiredTest(t *testing.T, subcommand string) {
+ th := api4.Setup().InitBasic()
+ defer th.TearDown()
+
+ path, err := os.Executable()
+ if err != nil {
+ t.Fail()
+ }
+ args := []string{"-test.run", "ExecCommand", "--", "--disableconfigwatch", "permissions", subcommand}
+ output, err := exec.Command(path, args...).CombinedOutput()
+
+ actual := string(output)
+ expected := utils.T("cli.license.critical")
+ if !strings.Contains(actual, expected) {
+ t.Errorf("Expected '%v' but got '%v'.", expected, actual)
+ }
+}