Add test for AnalyzeMetadata upload filter fetching dimensions from a video
authorMark Felder <feld@feld.me>
Tue, 8 Jun 2021 19:02:56 +0000 (14:02 -0500)
committerMark Felder <feld@feld.me>
Tue, 8 Jun 2021 19:02:56 +0000 (14:02 -0500)
test/fixtures/video.mp4 [new file with mode: 0644]
test/pleroma/upload/filter/analyze_metadata_test.exs

diff --git a/test/fixtures/video.mp4 b/test/fixtures/video.mp4
new file mode 100644 (file)
index 0000000..2021e3a
Binary files /dev/null and b/test/fixtures/video.mp4 differ
index 6f0e432ef034627b9f8ab59aea0e632deed3f1e2..488743952744101e16dc37bae6eb2c628878b86e 100644 (file)
@@ -16,4 +16,15 @@ defmodule Pleroma.Upload.Filter.AnalyzeMetadataTest do
 
     assert {:ok, :filtered, %{width: 1024, height: 768}} = AnalyzeMetadata.filter(upload)
   end
+
+  test "adds the video dimensions" do
+    upload = %Pleroma.Upload{
+      name: "coolvideo.mp4",
+      content_type: "video/mp4",
+      path: Path.absname("test/fixtures/video.mp4"),
+      tempfile: Path.absname("test/fixtures/video.mp4")
+    }
+
+    assert {:ok, :filtered, %{width: 480, height: 480}} = AnalyzeMetadata.filter(upload)
+  end
 end