From 5530c7dca47d8a012dbd85e6db459e48d615f00c Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Mon, 11 Dec 2023 10:00:15 +0400 Subject: [PATCH] MediaProxyTest: Fix test --- test/pleroma/web/media_proxy_test.exs | 17 ++++++++++++++++- 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 index ffab1247f..718892665 100644 --- 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)