diff options
author | Martin Kraft <mkraft@users.noreply.github.com> | 2018-05-17 11:37:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 11:37:00 -0400 |
commit | e0390632b3c941670671d968b8828bcefbf71581 (patch) | |
tree | d4eb82a217aa45c5be8a3afb2fc1d2d7ed5d6b37 /cmd/commands/permissions_test.go | |
parent | 463065c8ba4b4aece7fd9b7764ba917df3e73292 (diff) | |
download | chat-e0390632b3c941670671d968b8828bcefbf71581.tar.gz chat-e0390632b3c941670671d968b8828bcefbf71581.tar.bz2 chat-e0390632b3c941670671d968b8828bcefbf71581.zip |
MM-10264: Adds CLI command to import and export permissions. (#8787)
* MM-10264: Adds CLI command to import and export permissions.
* MM-10264: Changes Scheme Name to DisplayName and adds Name slug field.
* MM-10264: Changes display name max size.
* MM-10264: Another merge fix.
* MM-10264: Changes for more Schemes methods checking for migration.
* MM-10264: More updates for Schemes migration checking.
Diffstat (limited to 'cmd/commands/permissions_test.go')
-rw-r--r-- | cmd/commands/permissions_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/commands/permissions_test.go b/cmd/commands/permissions_test.go new file mode 100644 index 000000000..eeaa17109 --- /dev/null +++ b/cmd/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) + } +} |