diff options
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) } |