logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

only_media_test.exs (817B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Upload.Filter.OnlyMediaTest do
  5. use Pleroma.DataCase, async: true
  6. alias Pleroma.Upload
  7. alias Pleroma.Upload.Filter.OnlyMedia
  8. test "Allows media Content-Type" do
  9. ["audio/mpeg", "image/jpeg", "video/mp4"]
  10. |> Enum.each(fn type ->
  11. upload = %Upload{
  12. content_type: type
  13. }
  14. assert {:ok, :noop} = OnlyMedia.filter(upload)
  15. end)
  16. end
  17. test "Disallows non-media Content-Type" do
  18. ["application/javascript", "application/pdf", "text/html"]
  19. |> Enum.each(fn type ->
  20. upload = %Upload{
  21. content_type: type
  22. }
  23. assert {:error, _} = OnlyMedia.filter(upload)
  24. end)
  25. end
  26. end