X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fostatus%2Factivity_representer_test.exs;h=a3a92ce5bf01d0e625dcc3e49de23f4e573e92ea;hb=8a41d34673532c03cf99a2334399b9436e245f1b;hp=a4bb68c4d9722aa82428b4770227160a34e33b56;hpb=26d509cc861ad865b12d187fc163fa78c4c128a7;p=akkoma
diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs
index a4bb68c4d..a3a92ce5b 100644
--- a/test/web/ostatus/activity_representer_test.exs
+++ b/test/web/ostatus/activity_representer_test.exs
@@ -38,22 +38,23 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
test "a note activity" do
note_activity = insert(:note_activity)
+ object_data = Object.normalize(note_activity).data
user = User.get_cached_by_ap_id(note_activity.data["actor"])
expected = """
http://activitystrea.ms/schema/1.0/note
http://activitystrea.ms/schema/1.0/post
- #{note_activity.data["object"]["id"]}
+ #{object_data["id"]}
New note by #{user.nickname}
- #{note_activity.data["object"]["content"]}
- #{note_activity.data["object"]["published"]}
- #{note_activity.data["object"]["published"]}
+ #{object_data["content"]}
+ #{object_data["published"]}
+ #{object_data["published"]}
#{note_activity.data["context"]}
- #{note_activity.data["object"]["summary"]}
-
-
+ #{object_data["summary"]}
+
+
@@ -67,37 +68,31 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
end
test "a reply note" do
- note = insert(:note_activity)
- answer = insert(:note_activity)
- object = answer.data["object"]
- object = Map.put(object, "inReplyTo", note.data["object"]["id"])
-
- data = %{answer.data | "object" => object}
- answer = %{answer | data: data}
-
- note_object = Object.get_by_ap_id(note.data["object"]["id"])
+ user = insert(:user)
+ note_object = insert(:note)
+ _note = insert(:note_activity, %{note: note_object})
+ object = insert(:note, %{data: %{"inReplyTo" => note_object.data["id"]}})
+ answer = insert(:note_activity, %{note: object})
Repo.update!(
Object.change(note_object, %{data: Map.put(note_object.data, "external_url", "someurl")})
)
- user = User.get_cached_by_ap_id(answer.data["actor"])
-
expected = """
http://activitystrea.ms/schema/1.0/note
http://activitystrea.ms/schema/1.0/post
- #{answer.data["object"]["id"]}
+ #{object.data["id"]}
New note by #{user.nickname}
- #{answer.data["object"]["content"]}
- #{answer.data["object"]["published"]}
- #{answer.data["object"]["published"]}
+ #{object.data["content"]}
+ #{object.data["published"]}
+ #{object.data["published"]}
#{answer.data["context"]}
2hu
-
-
+
+
-
+
"""
@@ -112,7 +107,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
test "an announce activity" do
note = insert(:note_activity)
user = insert(:user)
- object = Object.get_cached_by_ap_id(note.data["object"]["id"])
+ object = Object.normalize(note)
{:ok, announce, _object} = ActivityPub.announce(user, object)
@@ -131,7 +126,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
http://activitystrea.ms/schema/1.0/share
#{announce.data["id"]}
#{user.nickname} repeated a notice
- RT #{note.data["object"]["content"]}
+ RT #{object.data["content"]}
#{announce.data["published"]}
#{announce.data["published"]}
#{announce.data["context"]}