1 defmodule Pleroma.Web.ActivityPub.ObjectViewTest do
6 alias Pleroma.Web.ActivityPub.ObjectView
7 alias Pleroma.Web.CommonAPI
9 test "renders a note object" do
12 result = ObjectView.render("object.json", %{object: note})
14 assert result["id"] == note.data["id"]
15 assert result["to"] == note.data["to"]
16 assert result["content"] == note.data["content"]
17 assert result["type"] == "Note"
18 assert result["@context"]
21 test "renders a note activity" do
22 note = insert(:note_activity)
23 object = Object.normalize(note)
25 result = ObjectView.render("object.json", %{object: note})
27 assert result["id"] == note.data["id"]
28 assert result["to"] == note.data["to"]
29 assert result["object"]["type"] == "Note"
30 assert result["object"]["content"] == object.data["content"]
31 assert result["type"] == "Create"
32 assert result["@context"]
35 test "renders a like activity" do
36 note = insert(:note_activity)
37 object = Object.normalize(note)
40 {:ok, like_activity, _} = CommonAPI.favorite(note.id, user)
42 result = ObjectView.render("object.json", %{object: like_activity})
44 assert result["id"] == like_activity.data["id"]
45 assert result["object"] == object.data["id"]
46 assert result["type"] == "Like"
49 test "renders an announce activity" do
50 note = insert(:note_activity)
51 object = Object.normalize(note)
54 {:ok, announce_activity, _} = CommonAPI.repeat(note.id, user)
56 result = ObjectView.render("object.json", %{object: announce_activity})
58 assert result["id"] == announce_activity.data["id"]
59 assert result["object"] == object.data["id"]
60 assert result["type"] == "Announce"