1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
7 alias Pleroma.Web.MediaProxy.Invalidation
9 import ExUnit.CaptureLog
12 on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
15 test "it logger error when script not found" do
16 assert capture_log(fn ->
17 assert Invalidation.Script.purge(
18 ["http://example.com/media/example.jpg"],
19 script_path: "./example"
20 ) == {:error, "%ErlangError{original: :enoent}"}
21 end) =~ "Error while cache purge: %ErlangError{original: :enoent}"
24 assert Invalidation.Script.purge(
25 ["http://example.com/media/example.jpg"],
27 ) == {:error, "\"not found script path\""}