remove `unread_conversation_count` from User
[akkoma] / test / upload / filter / exiftool_test.exs
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
5 defmodule Pleroma.Upload.Filter.ExiftoolTest do
6 use Pleroma.DataCase
7 alias Pleroma.Upload.Filter
8
9 test "apply exiftool filter" do
10 assert Pleroma.Utils.command_available?("exiftool")
11
12 File.cp!(
13 "test/fixtures/DSCN0010.jpg",
14 "test/fixtures/DSCN0010_tmp.jpg"
15 )
16
17 upload = %Pleroma.Upload{
18 name: "image_with_GPS_data.jpg",
19 content_type: "image/jpg",
20 path: Path.absname("test/fixtures/DSCN0010.jpg"),
21 tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg")
22 }
23
24 assert Filter.Exiftool.filter(upload) == :ok
25
26 {exif_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.jpg"])
27 {exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.jpg"])
28
29 refute exif_original == exif_filtered
30 assert String.match?(exif_original, ~r/GPS/)
31 refute String.match?(exif_filtered, ~r/GPS/)
32 end
33 end