2020-10-12 17:00:50 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-13 06:49:20 +00:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2020-10-12 17:00:50 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-18 06:22:26 +00:00
|
|
|
defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
|
2020-12-21 11:21:40 +00:00
|
|
|
use ExUnit.Case, async: true
|
2020-05-18 06:22:26 +00:00
|
|
|
alias Pleroma.Web.MediaProxy.Invalidation
|
|
|
|
|
|
|
|
import ExUnit.CaptureLog
|
|
|
|
|
2021-01-21 20:42:08 +00:00
|
|
|
test "it logs error when script is not found" do
|
2020-05-18 06:22:26 +00:00
|
|
|
assert capture_log(fn ->
|
|
|
|
assert Invalidation.Script.purge(
|
|
|
|
["http://example.com/media/example.jpg"],
|
2020-06-14 18:02:57 +00:00
|
|
|
script_path: "./example"
|
|
|
|
) == {:error, "%ErlangError{original: :enoent}"}
|
|
|
|
end) =~ "Error while cache purge: %ErlangError{original: :enoent}"
|
2020-05-18 06:22:26 +00:00
|
|
|
|
2020-06-14 18:02:57 +00:00
|
|
|
capture_log(fn ->
|
|
|
|
assert Invalidation.Script.purge(
|
|
|
|
["http://example.com/media/example.jpg"],
|
|
|
|
[]
|
|
|
|
) == {:error, "\"not found script path\""}
|
|
|
|
end)
|
2020-05-18 06:22:26 +00:00
|
|
|
end
|
|
|
|
end
|