summaryrefslogtreecommitdiffstats
path: root/app/diagnostics_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-23 02:39:51 -0700
committerGitHub <noreply@github.com>2017-10-23 02:39:51 -0700
commit08b7b1c4144f18a9dbf52bfe0eb9182f2b4eba4a (patch)
tree6f2613d6032cfb6d357925c0f64cc02920694549 /app/diagnostics_test.go
parentfd6192473b3c2a91d1520e366d931063e359a67d (diff)
downloadchat-08b7b1c4144f18a9dbf52bfe0eb9182f2b4eba4a.tar.gz
chat-08b7b1c4144f18a9dbf52bfe0eb9182f2b4eba4a.tar.bz2
chat-08b7b1c4144f18a9dbf52bfe0eb9182f2b4eba4a.zip
Reduce cfg boilerplate (#7689)
* reduce cfg boilerplate * fix compile error * user test fix * another test fix * simplify diagnostics / testing
Diffstat (limited to 'app/diagnostics_test.go')
-rw-r--r--app/diagnostics_test.go23
1 files changed, 10 insertions, 13 deletions
diff --git a/app/diagnostics_test.go b/app/diagnostics_test.go
index a7d879a7f..842322e9c 100644
--- a/app/diagnostics_test.go
+++ b/app/diagnostics_test.go
@@ -12,6 +12,9 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
@@ -29,21 +32,15 @@ func newTestServer() (chan string, *httptest.Server) {
}
func TestPluginSetting(t *testing.T) {
- before := utils.Cfg.PluginSettings.Plugins
- utils.Cfg.PluginSettings.Plugins = map[string]interface{}{
- "test": map[string]string{
- "foo": "bar",
+ settings := &model.PluginSettings{
+ Plugins: map[string]interface{}{
+ "test": map[string]string{
+ "foo": "bar",
+ },
},
}
- defer func() {
- utils.Cfg.PluginSettings.Plugins = before
- }()
- if pluginSetting("test", "foo", "asd") != "bar" {
- t.Fatal()
- }
- if pluginSetting("test", "qwe", "asd") != "asd" {
- t.Fatal()
- }
+ assert.Equal(t, "bar", pluginSetting(settings, "test", "foo", "asd"))
+ assert.Equal(t, "asd", pluginSetting(settings, "test", "qwe", "asd"))
}
func TestDiagnostics(t *testing.T) {