summaryrefslogtreecommitdiffstats
path: root/app/app_test.go
diff options
context:
space:
mode:
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"
+ })
+}