Merge remote-tracking branch 'remotes/origin/develop' into 1560-non-federating-instan...
[akkoma] / test / web / media_proxy / media_proxy_controller_test.exs
index 53b8f556b8a909804f31987e30d0ea64c6c21a39..7ac7e4af11618669e94f3e88cefad2c9a5377bdd 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do
@@ -7,11 +7,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do
   import Mock
   alias Pleroma.Config
 
-  setup do
-    media_proxy_config = Config.get([:media_proxy]) || []
-    on_exit(fn -> Config.put([:media_proxy], media_proxy_config) end)
-    :ok
-  end
+  clear_config(:media_proxy)
+  clear_config([Pleroma.Web.Endpoint, :secret_key_base])
 
   test "it returns 404 when MediaProxy disabled", %{conn: conn} do
     Config.put([:media_proxy, :enabled], false)
@@ -55,9 +52,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do
     url = Pleroma.Web.MediaProxy.encode_url("https://google.fn/test.png")
     invalid_url = String.replace(url, "test.png", "test-file.png")
     response = get(conn, invalid_url)
-    html = "<html><body>You are being <a href=\"#{url}\">redirected</a>.</body></html>"
     assert response.status == 302
-    assert response.resp_body == html
+    assert redirected_to(response) == url
   end
 
   test "it performs ReverseProxy.call when signature valid", %{conn: conn} do