diff options
author | Chris <ccbrown112@gmail.com> | 2017-10-18 15:36:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-18 15:36:43 -0700 |
commit | 8e19ba029f889519d93cf272960dce858971106c (patch) | |
tree | d8f38ac62661fb8578e2b5c3c619fe31ab29f480 /api4/openGraph_test.go | |
parent | 34a87fa8f47b1447b73e3ae56866b654801b3eee (diff) | |
download | chat-8e19ba029f889519d93cf272960dce858971106c.tar.gz chat-8e19ba029f889519d93cf272960dce858971106c.tar.bz2 chat-8e19ba029f889519d93cf272960dce858971106c.zip |
Reduce utils.Cfg references (#7650)
* app.UpdateConfig method
* test fix
* another test fix
* the config override option as-was is just error prone, remove it for now
* derp
Diffstat (limited to 'api4/openGraph_test.go')
-rw-r--r-- | api4/openGraph_test.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/api4/openGraph_test.go b/api4/openGraph_test.go index 04f207f55..6a14ad943 100644 --- a/api4/openGraph_test.go +++ b/api4/openGraph_test.go @@ -9,9 +9,8 @@ import ( "net/http/httptest" "strings" + "github.com/mattermost/mattermost-server/model" "testing" - - "github.com/mattermost/mattermost-server/utils" ) func TestGetOpenGraphMetadata(t *testing.T) { @@ -20,14 +19,18 @@ func TestGetOpenGraphMetadata(t *testing.T) { Client := th.Client - enableLinkPreviews := *utils.Cfg.ServiceSettings.EnableLinkPreviews - allowedInternalConnections := *utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections + enableLinkPreviews := *th.App.Config().ServiceSettings.EnableLinkPreviews + allowedInternalConnections := *th.App.Config().ServiceSettings.AllowedUntrustedInternalConnections defer func() { - *utils.Cfg.ServiceSettings.EnableLinkPreviews = enableLinkPreviews - utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = &allowedInternalConnections + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableLinkPreviews = enableLinkPreviews }) + th.App.UpdateConfig(func(cfg *model.Config) { + cfg.ServiceSettings.AllowedUntrustedInternalConnections = &allowedInternalConnections + }) }() - *utils.Cfg.ServiceSettings.EnableLinkPreviews = true - *utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost 127.0.0.1" + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableLinkPreviews = true }) + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost 127.0.0.1" + }) ogDataCacheMissCount := 0 @@ -72,7 +75,7 @@ func TestGetOpenGraphMetadata(t *testing.T) { } } - *utils.Cfg.ServiceSettings.EnableLinkPreviews = false + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableLinkPreviews = false }) _, resp := Client.OpenGraph(ts.URL + "/og-data/") CheckNotImplementedStatus(t, resp) } |