logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

script_test.exs (822B)


  1. defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
  2. use ExUnit.Case
  3. alias Pleroma.Web.MediaProxy.Invalidation
  4. import ExUnit.CaptureLog
  5. setup do
  6. on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
  7. end
  8. test "it logger error when script not found" do
  9. assert capture_log(fn ->
  10. assert Invalidation.Script.purge(
  11. ["http://example.com/media/example.jpg"],
  12. script_path: "./example"
  13. ) == {:error, "%ErlangError{original: :enoent}"}
  14. end) =~ "Error while cache purge: %ErlangError{original: :enoent}"
  15. capture_log(fn ->
  16. assert Invalidation.Script.purge(
  17. ["http://example.com/media/example.jpg"],
  18. []
  19. ) == {:error, "\"not found script path\""}
  20. end)
  21. end
  22. end