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