You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
981 B
31 lines
981 B
4 years ago
|
# Pleroma: A lightweight social networking server
|
||
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
4 years ago
|
defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
|
||
|
use ExUnit.Case
|
||
|
alias Pleroma.Web.MediaProxy.Invalidation
|
||
|
|
||
|
import ExUnit.CaptureLog
|
||
|
|
||
4 years ago
|
setup do
|
||
4 years ago
|
on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
|
||
4 years ago
|
end
|
||
|
|
||
4 years ago
|
test "it logger error when script not found" do
|
||
|
assert capture_log(fn ->
|
||
|
assert Invalidation.Script.purge(
|
||
|
["http://example.com/media/example.jpg"],
|
||
4 years ago
|
script_path: "./example"
|
||
|
) == {:error, "%ErlangError{original: :enoent}"}
|
||
|
end) =~ "Error while cache purge: %ErlangError{original: :enoent}"
|
||
4 years ago
|
|
||
4 years ago
|
capture_log(fn ->
|
||
|
assert Invalidation.Script.purge(
|
||
|
["http://example.com/media/example.jpg"],
|
||
|
[]
|
||
|
) == {:error, "\"not found script path\""}
|
||
|
end)
|
||
4 years ago
|
end
|
||
|
end
|