X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmedia_proxy%2Fmedia_proxy_test.exs;h=69d2a71a68d2e3a727a9b0e90c58dadb108c75be;hb=6efd3730c31c9121894c825b1bef87796a67d000;hp=96bdde21962bf2c15ca06ede45177ba829a300b1;hpb=c54ae662dcc08c0c04a1dff7bb7a361665e877b8;p=akkoma
diff --git a/test/web/media_proxy/media_proxy_test.exs b/test/web/media_proxy/media_proxy_test.exs
index 96bdde219..69d2a71a6 100644
--- a/test/web/media_proxy/media_proxy_test.exs
+++ b/test/web/media_proxy/media_proxy_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MediaProxyTest do
@@ -8,7 +8,8 @@ defmodule Pleroma.Web.MediaProxyTest do
import Pleroma.Web.MediaProxy
alias Pleroma.Web.MediaProxy.MediaProxyController
- clear_config([:media_proxy, :enabled])
+ setup do: clear_config([:media_proxy, :enabled])
+ setup do: clear_config(Pleroma.Upload)
describe "when enabled" do
setup do
@@ -123,15 +124,7 @@ defmodule Pleroma.Web.MediaProxyTest do
end
test "uses the configured base_url" do
- base_url = Pleroma.Config.get([:media_proxy, :base_url])
-
- if base_url do
- on_exit(fn ->
- Pleroma.Config.put([:media_proxy, :base_url], base_url)
- end)
- end
-
- Pleroma.Config.put([:media_proxy, :base_url], "https://cache.pleroma.social")
+ clear_config([:media_proxy, :base_url], "https://cache.pleroma.social")
url = "https://pleroma.soykaf.com/static/logo.png"
encoded = url(url)
@@ -212,8 +205,8 @@ defmodule Pleroma.Web.MediaProxyTest do
end
test "does not change whitelisted urls" do
- Pleroma.Config.put([:media_proxy, :whitelist], ["mycdn.akamai.com"])
- Pleroma.Config.put([:media_proxy, :base_url], "https://cache.pleroma.social")
+ clear_config([:media_proxy, :whitelist], ["mycdn.akamai.com"])
+ clear_config([:media_proxy, :base_url], "https://cache.pleroma.social")
media_url = "https://mycdn.akamai.com"
@@ -224,7 +217,6 @@ defmodule Pleroma.Web.MediaProxyTest do
end
test "ensure Pleroma.Upload base_url is always whitelisted" do
- upload_config = Pleroma.Config.get([Pleroma.Upload])
media_url = "https://media.pleroma.social"
Pleroma.Config.put([Pleroma.Upload, :base_url], media_url)
@@ -232,8 +224,6 @@ defmodule Pleroma.Web.MediaProxyTest do
encoded = url(url)
assert String.starts_with?(encoded, media_url)
-
- Pleroma.Config.put([Pleroma.Upload], upload_config)
end
end
end