diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2020-07-11 15:17:34 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2020-07-11 15:17:34 +0300 |
commit | 420ef64f95855a1fa09d66648d92032af192d02f (patch) | |
tree | d6cd24af80804fd088246b5d3195d806e8219f69 /test | |
parent | f7464724f5d5ae84fac3bc7291d2bb352ace6fdf (diff) | |
parent | 11dd29ef3f9bb5b0b3109eb572c3d5ae2c830ea3 (diff) | |
download | pleroma-420ef64f95855a1fa09d66648d92032af192d02f.tar.gz |
Merge branch 'develop' into refactor/fe-bundles
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/DSCN0010.jpg | bin | 0 -> 161713 bytes | |||
-rw-r--r-- | test/upload/filter/exiftool_test.exs | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/fixtures/DSCN0010.jpg b/test/fixtures/DSCN0010.jpg Binary files differnew file mode 100644 index 000000000..4a2c1552b --- /dev/null +++ b/test/fixtures/DSCN0010.jpg diff --git a/test/upload/filter/exiftool_test.exs b/test/upload/filter/exiftool_test.exs new file mode 100644 index 000000000..a1b7e46cd --- /dev/null +++ b/test/upload/filter/exiftool_test.exs @@ -0,0 +1,31 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Upload.Filter.ExiftoolTest do + use Pleroma.DataCase + alias Pleroma.Upload.Filter + + test "apply exiftool filter" do + File.cp!( + "test/fixtures/DSCN0010.jpg", + "test/fixtures/DSCN0010_tmp.jpg" + ) + + upload = %Pleroma.Upload{ + name: "image_with_GPS_data.jpg", + content_type: "image/jpg", + path: Path.absname("test/fixtures/DSCN0010.jpg"), + tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg") + } + + assert Filter.Exiftool.filter(upload) == :ok + + {exif_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.jpg"]) + {exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.jpg"]) + + refute exif_original == exif_filtered + assert String.match?(exif_original, ~r/GPS/) + refute String.match?(exif_filtered, ~r/GPS/) + end +end |