diff options
author | lain <lain@soykaf.club> | 2020-07-11 11:31:44 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-11 11:31:44 +0000 |
commit | 11dd29ef3f9bb5b0b3109eb572c3d5ae2c830ea3 (patch) | |
tree | c3f21dea8d7ea38ab12563f2da7289e001e7f55c /test | |
parent | c409a064ba8f06c9fb1f1af88f9bb7cb4ba4121b (diff) | |
parent | b329f05ed63657aa19b227b9b919662dad56ecae (diff) | |
download | pleroma-11dd29ef3f9bb5b0b3109eb572c3d5ae2c830ea3.tar.gz |
Merge branch 'feature/upload-filter-exiftool' into 'develop'
Add Pleroma.Upload.Filter.Exiftool
Closes #1935
See merge request pleroma/pleroma!2744
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 |