StripLocationTest: Add failing test for PNGs
This commit is contained in:
parent
394cb1e0f5
commit
ba88c5078a
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,7 +6,7 @@
|
|||||||
/test/instance
|
/test/instance
|
||||||
/test/uploads
|
/test/uploads
|
||||||
/.elixir_ls
|
/.elixir_ls
|
||||||
/test/fixtures/DSCN0010_tmp.jpg
|
/test/fixtures/DSCN0010_tmp*
|
||||||
/test/fixtures/test_tmp.txt
|
/test/fixtures/test_tmp.txt
|
||||||
/test/fixtures/image_tmp.jpg
|
/test/fixtures/image_tmp.jpg
|
||||||
/test/tmp/
|
/test/tmp/
|
||||||
|
BIN
test/fixtures/DSCN0010.png
vendored
Normal file
BIN
test/fixtures/DSCN0010.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 744 KiB |
@ -9,29 +9,31 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do
|
|||||||
test "apply exiftool filter" do
|
test "apply exiftool filter" do
|
||||||
assert Pleroma.Utils.command_available?("exiftool")
|
assert Pleroma.Utils.command_available?("exiftool")
|
||||||
|
|
||||||
File.cp!(
|
~w{jpg png}
|
||||||
"test/fixtures/DSCN0010.jpg",
|
|> Enum.map(fn type ->
|
||||||
"test/fixtures/DSCN0010_tmp.jpg"
|
File.cp!(
|
||||||
)
|
"test/fixtures/DSCN0010.#{type}",
|
||||||
|
"test/fixtures/DSCN0010_tmp.#{type}"
|
||||||
|
)
|
||||||
|
|
||||||
upload = %Pleroma.Upload{
|
upload = %Pleroma.Upload{
|
||||||
name: "image_with_GPS_data.jpg",
|
name: "image_with_GPS_data.#{type}",
|
||||||
content_type: "image/jpeg",
|
content_type: "image/jpeg",
|
||||||
path: Path.absname("test/fixtures/DSCN0010.jpg"),
|
path: Path.absname("test/fixtures/DSCN0010.#{type}"),
|
||||||
tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg")
|
tempfile: Path.absname("test/fixtures/DSCN0010_tmp.#{type}")
|
||||||
}
|
}
|
||||||
|
|
||||||
assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :filtered}
|
assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :filtered}
|
||||||
|
|
||||||
{exif_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.jpg"])
|
{exif_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.#{type}"])
|
||||||
{exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.jpg"])
|
{exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.#{type}"])
|
||||||
|
|
||||||
refute exif_original == exif_filtered
|
assert String.match?(exif_original, ~r/GPS/)
|
||||||
assert String.match?(exif_original, ~r/GPS/)
|
refute String.match?(exif_filtered, ~r/GPS/)
|
||||||
refute String.match?(exif_filtered, ~r/GPS/)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "verify webp, heic, svg files are skipped" do
|
test "verify webp, heic, svg files are skipped" do
|
||||||
uploads =
|
uploads =
|
||||||
~w{webp heic svg svg+xml}
|
~w{webp heic svg svg+xml}
|
||||||
|> Enum.map(fn type ->
|
|> Enum.map(fn type ->
|
||||||
|
Loading…
Reference in New Issue
Block a user