commit: 5530c7dca47d8a012dbd85e6db459e48d615f00c
parent 5a95847c5d30f141f51ddf385dbd46796a832020
Author: Lain Soykaf <lain@lain.com>
Date: Mon, 11 Dec 2023 10:00:15 +0400
MediaProxyTest: Fix test
Diffstat:
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/test/pleroma/web/media_proxy_test.exs b/test/pleroma/web/media_proxy_test.exs
@@ -7,9 +7,19 @@ defmodule Pleroma.Web.MediaProxyTest do
use Pleroma.Tests.Helpers
alias Pleroma.Config
+ alias Pleroma.UnstubbedConfigMock, as: ConfigMock
alias Pleroma.Web.Endpoint
alias Pleroma.Web.MediaProxy
+ import Mox
+
+ setup do
+ ConfigMock
+ |> stub_with(Pleroma.Test.StaticConfig)
+
+ :ok
+ end
+
defp decode_result(encoded) do
{:ok, decoded} = MediaProxy.decode_url(encoded)
decoded
@@ -222,7 +232,12 @@ defmodule Pleroma.Web.MediaProxyTest do
test "ensure Pleroma.Upload base_url is always whitelisted" do
media_url = "https://media.pleroma.social"
- clear_config([Pleroma.Upload, :base_url], media_url)
+
+ ConfigMock
+ |> stub(:get, fn
+ [Pleroma.Upload, :base_url] -> media_url
+ path -> Pleroma.Test.StaticConfig.get(path)
+ end)
url = "#{media_url}/static/logo.png"
encoded = MediaProxy.url(url)