MediaProxyCacheControllerTest: Fix tests.
This commit is contained in:
parent
2c10843bc4
commit
5a95847c5d
|
@ -5,9 +5,11 @@
|
||||||
defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
||||||
use Pleroma.Web.ConnCase
|
use Pleroma.Web.ConnCase
|
||||||
|
|
||||||
import Pleroma.Factory
|
|
||||||
import Mock
|
import Mock
|
||||||
|
import Mox
|
||||||
|
import Pleroma.Factory
|
||||||
|
|
||||||
|
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
||||||
alias Pleroma.Web.MediaProxy
|
alias Pleroma.Web.MediaProxy
|
||||||
|
|
||||||
setup do: clear_config([:media_proxy])
|
setup do: clear_config([:media_proxy])
|
||||||
|
@ -128,6 +130,9 @@ test "perform invalidates cache of MediaProxy", %{conn: conn} do
|
||||||
"http://example.com/media/fb1f4d.jpg"
|
"http://example.com/media/fb1f4d.jpg"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ConfigMock
|
||||||
|
|> stub_with(Pleroma.Test.StaticConfig)
|
||||||
|
|
||||||
with_mocks [
|
with_mocks [
|
||||||
{MediaProxy.Invalidation.Script, [],
|
{MediaProxy.Invalidation.Script, [],
|
||||||
[
|
[
|
||||||
|
@ -150,6 +155,9 @@ test "perform invalidates cache of MediaProxy and adds url to banned", %{conn: c
|
||||||
"http://example.com/media/fb1f4d.jpg"
|
"http://example.com/media/fb1f4d.jpg"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ConfigMock
|
||||||
|
|> stub_with(Pleroma.Test.StaticConfig)
|
||||||
|
|
||||||
with_mocks [{MediaProxy.Invalidation.Script, [], [purge: fn _, _ -> {"ok", 0} end]}] do
|
with_mocks [{MediaProxy.Invalidation.Script, [], [purge: fn _, _ -> {"ok", 0} end]}] do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|
|
Loading…
Reference in New Issue