From d413f9bf7078cf93c3efcd0ae195539dd3c7ede0 Mon Sep 17 00:00:00 2001 From: Phantasm Date: Sat, 27 Sep 2025 12:19:47 +0200 Subject: [PATCH] MediaProxy: fix Pleroma.HTTP.encode_url not being available in test env --- .../mrf/media_proxy_warming_policy_test.exs | 25 +++++++++++++------ 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 index 0da3afa3b..13b4d24b8 100644 --- 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