diff options
| author | lain <lain@soykaf.club> | 2024-06-30 09:28:17 +0000 | 
|---|---|---|
| committer | lain <lain@soykaf.club> | 2024-06-30 09:28:17 +0000 | 
| commit | ccbbee7963c8d67b99a44849000f7ac7d6b19109 (patch) | |
| tree | b1a614d8aaddbd985d8c52bf4e316c762ad9746b /test | |
| parent | 801a9367d00c0e036d1c157d6ca5c4e46bd0d95f (diff) | |
| parent | abbc5b6e480ae7f376d5a75931ff03d95178c38d (diff) | |
| download | pleroma-ccbbee7963c8d67b99a44849000f7ac7d6b19109.tar.gz pleroma-ccbbee7963c8d67b99a44849000f7ac7d6b19109.zip | |
Merge branch 'exif' into 'develop'
Ensure StripLocation works for PNGs
See merge request pleroma/pleroma!4167
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixtures/DSCN0010.png | bin | 0 -> 762272 bytes | |||
| -rw-r--r-- | test/pleroma/upload/filter/exiftool/strip_location_test.exs | 44 | 
2 files changed, 23 insertions, 21 deletions
| diff --git a/test/fixtures/DSCN0010.png b/test/fixtures/DSCN0010.pngBinary files differ new file mode 100644 index 000000000..66f2f05f7 --- /dev/null +++ b/test/fixtures/DSCN0010.png diff --git a/test/pleroma/upload/filter/exiftool/strip_location_test.exs b/test/pleroma/upload/filter/exiftool/strip_location_test.exs index bcb5f3f60..4dcd4dce3 100644 --- a/test/pleroma/upload/filter/exiftool/strip_location_test.exs +++ b/test/pleroma/upload/filter/exiftool/strip_location_test.exs @@ -9,29 +9,31 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do    test "apply exiftool filter" do      assert Pleroma.Utils.command_available?("exiftool") -    File.cp!( -      "test/fixtures/DSCN0010.jpg", -      "test/fixtures/DSCN0010_tmp.jpg" -    ) - -    upload = %Pleroma.Upload{ -      name: "image_with_GPS_data.jpg", -      content_type: "image/jpeg", -      path: Path.absname("test/fixtures/DSCN0010.jpg"), -      tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg") -    } - -    assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :filtered} - -    {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/) +    ~w{jpg png} +    |> Enum.map(fn type -> +      File.cp!( +        "test/fixtures/DSCN0010.#{type}", +        "test/fixtures/DSCN0010_tmp.#{type}" +      ) + +      upload = %Pleroma.Upload{ +        name: "image_with_GPS_data.#{type}", +        content_type: "image/jpeg", +        path: Path.absname("test/fixtures/DSCN0010.#{type}"), +        tempfile: Path.absname("test/fixtures/DSCN0010_tmp.#{type}") +      } + +      assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :filtered} + +      {exif_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.#{type}"]) +      {exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.#{type}"]) + +      assert String.match?(exif_original, ~r/GPS/) +      refute String.match?(exif_filtered, ~r/GPS/) +    end)    end -  test "verify webp, heic, svg  files are skipped" do +  test "verify webp, heic, svg files are skipped" do      uploads =        ~w{webp heic svg svg+xml}        |> Enum.map(fn type -> | 
