diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-03-07 20:04:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 20:04:18 +0000 |
commit | b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5 (patch) | |
tree | 00d2bbb524e27727dc111994082f5293e6d12b11 /cmd/commands/config_test.go | |
parent | 03b6d1f652407fa9c3ec7e740e120a1c3e920de0 (diff) | |
download | chat-b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5.tar.gz chat-b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5.tar.bz2 chat-b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5.zip |
Adding enterprise commands support (#8327)
Diffstat (limited to 'cmd/commands/config_test.go')
-rw-r--r-- | cmd/commands/config_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/commands/config_test.go b/cmd/commands/config_test.go new file mode 100644 index 000000000..54ddfcb61 --- /dev/null +++ b/cmd/commands/config_test.go @@ -0,0 +1,31 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package commands + +import ( + "io/ioutil" + "os" + "path/filepath" + "testing" + + "github.com/mattermost/mattermost-server/cmd" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/model" +) + +func TestConfigValidate(t *testing.T) { + dir, err := ioutil.TempDir("", "") + require.NoError(t, err) + defer os.RemoveAll(dir) + + path := filepath.Join(dir, "config.json") + config := &model.Config{} + config.SetDefaults() + require.NoError(t, ioutil.WriteFile(path, []byte(config.ToJson()), 0600)) + + assert.Error(t, cmd.RunCommand(t, "--config", "foo.json", "config", "validate")) + assert.NoError(t, cmd.RunCommand(t, "--config", path, "config", "validate")) +} |