summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-05-12 13:38:11 -0500
committerAlex Gleason <alex@alexgleason.me>2021-05-12 15:07:31 -0500
commitab9eabdf20180f2dd8539cf5d3dc0fdc6412496b (patch)
tree3d9c077184c9f9aba5c335e90157ecaf6d754773 /test
parentb221d77a6da07c684bdbc63ddf4500e0d7ffeae8 (diff)
downloadpleroma-ab9eabdf20180f2dd8539cf5d3dc0fdc6412496b.tar.gz
pleroma-ab9eabdf20180f2dd8539cf5d3dc0fdc6412496b.zip
Add SetMeta filter to store uploaded image sizes
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/upload/filter/set_meta_test.exs19
-rw-r--r--test/pleroma/web/mastodon_api/views/status_view_test.exs5
2 files changed, 23 insertions, 1 deletions
diff --git a/test/pleroma/upload/filter/set_meta_test.exs b/test/pleroma/upload/filter/set_meta_test.exs
new file mode 100644
index 000000000..650e527b4
--- /dev/null
+++ b/test/pleroma/upload/filter/set_meta_test.exs
@@ -0,0 +1,19 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Upload.Filter.SetMetaTest do
+ use Pleroma.DataCase, async: true
+ alias Pleroma.Upload.Filter.SetMeta
+
+ test "adds the image dimensions" do
+ upload = %Pleroma.Upload{
+ name: "an… image.jpg",
+ content_type: "image/jpeg",
+ path: Path.absname("test/fixtures/image.jpg"),
+ tempfile: Path.absname("test/fixtures/image.jpg")
+ }
+
+ assert {:ok, :filtered, %{width: 1024, height: 768}} = SetMeta.filter(upload)
+ end
+end
diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs
index 2de3afc4f..e6c37e782 100644
--- a/test/pleroma/web/mastodon_api/views/status_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs
@@ -458,7 +458,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
"url" => [
%{
"mediaType" => "image/png",
- "href" => "someurl"
+ "href" => "someurl",
+ "width" => 200,
+ "height" => 100
}
],
"blurhash" => "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn",
@@ -474,6 +476,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
text_url: "someurl",
description: nil,
pleroma: %{mime_type: "image/png"},
+ meta: %{original: %{width: 200, height: 100, aspect: 2}},
blurhash: "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn"
}