diff options
author | Ivan Tashkinov <ivant.business@gmail.com> | 2019-07-08 19:53:02 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivant.business@gmail.com> | 2019-07-08 19:53:02 +0300 |
commit | daff85a985c165c73fda3fcd20a3f46c76d36e6d (patch) | |
tree | 22edb1ef324ee2b89f276fb038b415d2c30c7b05 /test/web/ostatus/activity_representer_test.exs | |
parent | 3589b30ddc9d0c23ca6f00264cff05e53be1b270 (diff) | |
download | pleroma-daff85a985c165c73fda3fcd20a3f46c76d36e6d.tar.gz pleroma-daff85a985c165c73fda3fcd20a3f46c76d36e6d.zip |
[#878] Refactored assumptions on embedded object presence in tests. Adjusted note factory to not embed object into activity.
Diffstat (limited to 'test/web/ostatus/activity_representer_test.exs')
-rw-r--r-- | test/web/ostatus/activity_representer_test.exs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs index 16ee02abb..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 = """ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type> <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> - <id>#{note_activity.data["object"]["id"]}</id> + <id>#{object_data["id"]}</id> <title>New note by #{user.nickname}</title> - <content type="html">#{note_activity.data["object"]["content"]}</content> - <published>#{note_activity.data["object"]["published"]}</published> - <updated>#{note_activity.data["object"]["published"]}</updated> + <content type="html">#{object_data["content"]}</content> + <published>#{object_data["published"]}</published> + <updated>#{object_data["published"]}</updated> <ostatus:conversation ref="#{note_activity.data["context"]}">#{note_activity.data["context"]}</ostatus:conversation> <link ref="#{note_activity.data["context"]}" rel="ostatus:conversation" /> - <summary>#{note_activity.data["object"]["summary"]}</summary> - <link type="application/atom+xml" href="#{note_activity.data["object"]["id"]}" rel="self" /> - <link type="text/html" href="#{note_activity.data["object"]["id"]}" rel="alternate" /> + <summary>#{object_data["summary"]}</summary> + <link type="application/atom+xml" href="#{object_data["id"]}" rel="self" /> + <link type="text/html" href="#{object_data["id"]}" rel="alternate" /> <category term="2hu"/> <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/> <link name="2hu" rel="emoji" href="corndog.png" /> @@ -106,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) @@ -125,7 +126,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do <activity:verb>http://activitystrea.ms/schema/1.0/share</activity:verb> <id>#{announce.data["id"]}</id> <title>#{user.nickname} repeated a notice</title> - <content type="html">RT #{note.data["object"]["content"]}</content> + <content type="html">RT #{object.data["content"]}</content> <published>#{announce.data["published"]}</published> <updated>#{announce.data["published"]}</updated> <ostatus:conversation ref="#{announce.data["context"]}">#{announce.data["context"]}</ostatus:conversation> |