logo

pleroma

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

dedupe_test.exs (861B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Upload.Filter.DedupeTest do
  5. use Pleroma.DataCase
  6. alias Pleroma.Upload
  7. alias Pleroma.Upload.Filter.Dedupe
  8. @shasum "e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781"
  9. test "adds shasum" do
  10. File.cp!(
  11. "test/fixtures/image.jpg",
  12. "test/fixtures/image_tmp.jpg"
  13. )
  14. upload = %Upload{
  15. name: "an… image.jpg",
  16. content_type: "image/jpg",
  17. path: Path.absname("test/fixtures/image_tmp.jpg"),
  18. tempfile: Path.absname("test/fixtures/image_tmp.jpg")
  19. }
  20. assert {
  21. :ok,
  22. :filtered,
  23. %Pleroma.Upload{id: @shasum, path: @shasum <> ".jpg"}
  24. } = Dedupe.filter(upload)
  25. end
  26. end