diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-09-10 11:51:01 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-09-10 11:51:01 +0200 |
commit | fc10875895abd9add5a7834c4b5a64cc5b9401f8 (patch) | |
tree | 5a634eadc93187ddf47d074ac583057d2e62a931 /test | |
parent | 96473dfac02d901e5b915ca56a34ce67b30c10d5 (diff) | |
download | pleroma-fc10875895abd9add5a7834c4b5a64cc5b9401f8.tar.gz pleroma-fc10875895abd9add5a7834c4b5a64cc5b9401f8.zip |
Add attachments to mastoapi statuses.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index b8a96f71a..a12fc8244 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -2,7 +2,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do use Pleroma.DataCase alias Pleroma.Web.MastodonAPI.{StatusView, AccountView} - alias Pleroma.User + alias Pleroma.{User, Object} alias Pleroma.Web.OStatus import Pleroma.Factory @@ -50,4 +50,28 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert status.mentions == [AccountView.render("mention.json", %{user: user})] end + + test "attachments" do + incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml") + object = %{ + "type" => "Image", + "url" => [ + %{ + "mediaType" => "image/png", + "href" => "someurl" + } + ], + "uuid" => 6 + } + + expected = %{ + id: 6, + type: "image", + url: "someurl", + remote_url: "someurl", + preview_url: "someurl" + } + + assert expected == StatusView.render("attachment.json", %{attachment: object}) + end end |