mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
31 lines
763 B
Go
31 lines
763 B
Go
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"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, runCommand(t, "--config", "foo.json", "config", "validate"))
|
|
assert.NoError(t, runCommand(t, "--config", path, "config", "validate"))
|
|
}
|