Merge branch 'develop' into issue/1855
[akkoma] / test / web / media_proxy / invalidations / script_test.exs
1 defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
2 use ExUnit.Case
3 alias Pleroma.Web.MediaProxy.Invalidation
4
5 import ExUnit.CaptureLog
6
7 setup do
8 on_exit(fn -> Cachex.clear(:deleted_urls_cache) end)
9 :ok
10 end
11
12 test "it logger error when script not found" do
13 assert capture_log(fn ->
14 assert Invalidation.Script.purge(
15 ["http://example.com/media/example.jpg"],
16 script_path: "./example"
17 ) == {:error, "%ErlangError{original: :enoent}"}
18 end) =~ "Error while cache purge: %ErlangError{original: :enoent}"
19
20 capture_log(fn ->
21 assert Invalidation.Script.purge(
22 ["http://example.com/media/example.jpg"],
23 []
24 ) == {:error, "\"not found script path\""}
25 end)
26 end
27 end