diff options
author | Jesse Haka <haka.jesse@gmail.com> | 2018-10-02 09:00:50 +0300 |
---|---|---|
committer | Jesús Espino <jespinog@gmail.com> | 2018-10-02 08:00:50 +0200 |
commit | 3e462713debd5c992aa071bed902110bed88ec67 (patch) | |
tree | 983523b496897a1e39a38828e6db8401c79f70b2 /api4/system_test.go | |
parent | 328d9a55ee9bec51b5e36f64920bf8d4d59aeee2 (diff) | |
download | chat-3e462713debd5c992aa071bed902110bed88ec67.tar.gz chat-3e462713debd5c992aa071bed902110bed88ec67.tar.bz2 chat-3e462713debd5c992aa071bed902110bed88ec67.zip |
if EnableLinkPreviews not enabled, do not call url (#9461)
Diffstat (limited to 'api4/system_test.go')
-rw-r--r-- | api4/system_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/api4/system_test.go b/api4/system_test.go index c66e08976..32fadd380 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -717,6 +717,12 @@ func TestRedirectLocation(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client + enableLinkPreviews := *th.App.Config().ServiceSettings.EnableLinkPreviews + defer func() { + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableLinkPreviews = enableLinkPreviews }) + }() + + *th.App.Config().ServiceSettings.EnableLinkPreviews = true _, resp := th.SystemAdminClient.GetRedirectLocation("https://mattermost.com/", "") CheckNoError(t, resp) @@ -730,6 +736,19 @@ func TestRedirectLocation(t *testing.T) { t.Errorf("Expected %v but got %v.", expected, actual) } + *th.App.Config().ServiceSettings.EnableLinkPreviews = false + actual, resp = th.SystemAdminClient.GetRedirectLocation("https://mattermost.com/", "") + CheckNoError(t, resp) + assert.Equal(t, actual, "") + + actual, resp = th.SystemAdminClient.GetRedirectLocation("", "") + CheckNoError(t, resp) + assert.Equal(t, actual, "") + + actual, resp = th.SystemAdminClient.GetRedirectLocation(mockBitlyLink, "") + CheckNoError(t, resp) + assert.Equal(t, actual, "") + Client.Logout() _, resp = Client.GetRedirectLocation("", "") CheckUnauthorizedStatus(t, resp) |