488743952744101e16dc37bae6eb2c628878b86e
[akkoma] / test / pleroma / upload / filter / analyze_metadata_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Upload.Filter.AnalyzeMetadataTest do
6 use Pleroma.DataCase, async: true
7 alias Pleroma.Upload.Filter.AnalyzeMetadata
8
9 test "adds the image dimensions" do
10 upload = %Pleroma.Upload{
11 name: "an… image.jpg",
12 content_type: "image/jpeg",
13 path: Path.absname("test/fixtures/image.jpg"),
14 tempfile: Path.absname("test/fixtures/image.jpg")
15 }
16
17 assert {:ok, :filtered, %{width: 1024, height: 768}} = AnalyzeMetadata.filter(upload)
18 end
19
20 test "adds the video dimensions" do
21 upload = %Pleroma.Upload{
22 name: "coolvideo.mp4",
23 content_type: "video/mp4",
24 path: Path.absname("test/fixtures/video.mp4"),
25 tempfile: Path.absname("test/fixtures/video.mp4")
26 }
27
28 assert {:ok, :filtered, %{width: 480, height: 480}} = AnalyzeMetadata.filter(upload)
29 end
30 end