logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: d413f9bf7078cf93c3efcd0ae195539dd3c7ede0
parent 004ea90b29fec5e7b7b53b40f6acb6455a2340db
Author: Phantasm <phantasm@centrum.cz>
Date:   Sat, 27 Sep 2025 12:19:47 +0200

MediaProxy: fix Pleroma.HTTP.encode_url not being available in test env

Diffstat:

Mtest/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs25+++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs @@ -58,10 +58,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do {:ok, %Tesla.Env{status: 200, body: ""}} end) - with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do - MediaProxyWarmingPolicy.filter(@message) + with_mock HTTP, + get: fn _, _, _ -> {:ok, []} end, + encode_url: fn url -> :meck.passthrough([url]) end, + encode_url: fn url, opts -> :meck.passthrough([url, opts]) end do + MediaProxyWarmingPolicy.filter(@message) - assert called(HTTP.get(:_, :_, :_)) + assert called(HTTP.get(:_, :_, :_)) end end @@ -85,10 +88,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do {:ok, %Tesla.Env{status: 200, body: ""}} end) - with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do - MRF.filter_one(MediaProxyWarmingPolicy, @message_with_history) + with_mock HTTP, + get: fn _, _, _ -> {:ok, []} end, + encode_url: fn url -> :meck.passthrough([url]) end, + encode_url: fn url, opts -> :meck.passthrough([url, opts]) end do + MRF.filter_one(MediaProxyWarmingPolicy, @message_with_history) - assert called(HTTP.get(:_, :_, :_)) + assert called(HTTP.get(:_, :_, :_)) end end @@ -97,8 +103,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do {:ok, %Tesla.Env{status: 200, body: ""}} end) - with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do - MRF.filter_one(MediaProxyWarmingPolicy, @message_with_history |> Map.put("type", "Update")) + with_mock HTTP, + get: fn _, _, _ -> {:ok, []} end, + encode_url: fn url -> :meck.passthrough([url]) end, + encode_url: fn url, opts -> :meck.passthrough([url, opts]) end do + MRF.filter_one(MediaProxyWarmingPolicy, @message_with_history |> Map.put("type", "Update")) assert called(HTTP.get(:_, :_, :_)) end