MediaProxy: fix Pleroma.HTTP.encode_url not being available in test env
This commit is contained in:
parent
004ea90b29
commit
d413f9bf70
1 changed files with 17 additions and 8 deletions
|
|
@ -58,10 +58,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do
|
||||||
{:ok, %Tesla.Env{status: 200, body: ""}}
|
{:ok, %Tesla.Env{status: 200, body: ""}}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do
|
with_mock HTTP,
|
||||||
MediaProxyWarmingPolicy.filter(@message)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -85,10 +88,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do
|
||||||
{:ok, %Tesla.Env{status: 200, body: ""}}
|
{:ok, %Tesla.Env{status: 200, body: ""}}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do
|
with_mock HTTP,
|
||||||
MRF.filter_one(MediaProxyWarmingPolicy, @message_with_history)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -97,8 +103,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do
|
||||||
{:ok, %Tesla.Env{status: 200, body: ""}}
|
{:ok, %Tesla.Env{status: 200, body: ""}}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do
|
with_mock HTTP,
|
||||||
MRF.filter_one(MediaProxyWarmingPolicy, @message_with_history |> Map.put("type", "Update"))
|
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(:_, :_, :_))
|
assert called(HTTP.get(:_, :_, :_))
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue