summaryrefslogtreecommitdiffstats
path: root/app/app_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-11-03 17:23:33 -0500
committerChristopher Speller <crspeller@gmail.com>2017-11-03 15:23:33 -0700
commit85efdd6b5b94a4909ab30ae4c230fb515b91b22b (patch)
tree4c42ce9b0915bb9e2e5b9f5d25dd6607a7d30c86 /app/app_test.go
parent2acb5486157691c5b52656f7b45e0a2ab18d1c68 (diff)
downloadchat-85efdd6b5b94a4909ab30ae4c230fb515b91b22b.tar.gz
chat-85efdd6b5b94a4909ab30ae4c230fb515b91b22b.tar.bz2
chat-85efdd6b5b94a4909ab30ae4c230fb515b91b22b.zip
invoke config listeners when app.UpdateConfig is used (#7773)
Diffstat (limited to 'app/app_test.go')
-rw-r--r--app/app_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/app_test.go b/app/app_test.go
index ac39b49fe..17189956d 100644
--- a/app/app_test.go
+++ b/app/app_test.go
@@ -10,6 +10,9 @@ import (
l4g "github.com/alecthomas/log4go"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/store/storetest"
"github.com/mattermost/mattermost-server/utils"
)
@@ -49,3 +52,23 @@ func TestAppRace(t *testing.T) {
a.Shutdown()
}
}
+
+func TestUpdateConfig(t *testing.T) {
+ th := Setup()
+ defer th.TearDown()
+
+ prev := *th.App.Config().ServiceSettings.SiteURL
+ defer th.App.UpdateConfig(func(cfg *model.Config) {
+ *cfg.ServiceSettings.SiteURL = prev
+ })
+
+ listener := utils.AddConfigListener(func(old, current *model.Config) {
+ assert.Equal(t, prev, *old.ServiceSettings.SiteURL)
+ assert.Equal(t, "foo", *current.ServiceSettings.SiteURL)
+ })
+ defer utils.RemoveConfigListener(listener)
+
+ th.App.UpdateConfig(func(cfg *model.Config) {
+ *cfg.ServiceSettings.SiteURL = "foo"
+ })
+}