Tweaks to clear_config calls in tests in order to prevent side effects on config during test suite execution.
This commit is contained in:
parent
9906c6fb6f
commit
4f8c3462a8
31 changed files with 87 additions and 117 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ defmodule Pleroma.Web.MediaProxyTest do
|
|||
alias Pleroma.Web.MediaProxy.MediaProxyController
|
||||
|
||||
clear_config([:media_proxy, :enabled])
|
||||
clear_config(Pleroma.Upload)
|
||||
|
||||
describe "when enabled" do
|
||||
setup do
|
||||
|
|
@ -224,7 +225,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 +232,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue