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