1 defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
4 alias Pleroma.Web.MastodonAPI.{StatusView, AccountView}
5 alias Pleroma.{User, Object}
6 alias Pleroma.Web.OStatus
9 test "a note activity" do
10 note = insert(:note_activity)
11 user = User.get_cached_by_ap_id(note.data["actor"])
13 status = StatusView.render("status.json", %{activity: note})
17 uri: note.data["object"]["id"],
18 url: note.data["object"]["external_id"],
19 account: AccountView.render("account.json", %{user: user}),
21 in_reply_to_account_id: nil,
23 content: HtmlSanitizeEx.basic_html(note.data["object"]["content"]),
24 created_at: note.data["object"]["published"],
33 media_attachments: [],
40 assert status == expected
43 test "contains mentions" do
44 incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml")
45 user = insert(:user, %{ap_id: "https://pleroma.soykaf.com/users/lain"})
47 {:ok, [activity]} = OStatus.handle_incoming(incoming)
49 status = StatusView.render("status.json", %{activity: activity})
51 assert status.mentions == [AccountView.render("mention.json", %{user: user})]
55 incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml")
60 "mediaType" => "image/png",
71 remote_url: "someurl",
72 preview_url: "someurl"
75 assert expected == StatusView.render("attachment.json", %{attachment: object})