1 defmodule Pleroma.Web.MediaProxy.Invalidation.HttpTest do
3 alias Pleroma.Web.MediaProxy.Invalidation
5 import ExUnit.CaptureLog
8 test "logs hasn't error message when request is valid" do
10 %{method: :purge, url: "http://example.com/media/example.jpg"} ->
11 %Tesla.Env{status: 200}
14 refute capture_log(fn ->
15 assert Invalidation.Http.purge(
16 ["http://example.com/media/example.jpg"],
19 end) =~ "Error while cache purge"
22 test "it write error message in logs when request invalid" do
24 %{method: :purge, url: "http://example.com/media/example1.jpg"} ->
25 %Tesla.Env{status: 404}
28 assert capture_log(fn ->
29 assert Invalidation.Http.purge(
30 ["http://example.com/media/example1.jpg"],
33 end) =~ "Error while cache purge: url - http://example.com/media/example1.jpg"