aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/activity_pub_test.exs14
-rw-r--r--test/web/activity_pub/transmogrifier_test.exs15
2 files changed, 28 insertions, 1 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs
index 2ed280aa6..4aeabc596 100644
--- a/test/web/activity_pub/activity_pub_test.exs
+++ b/test/web/activity_pub/activity_pub_test.exs
@@ -268,7 +268,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
describe "fetching an object" do
test "it fetches an object" do
{:ok, object} = ActivityPub.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
- assert Activity.get_create_activity_by_object_ap_id(object.data["id"])
+ assert activity = Activity.get_create_activity_by_object_ap_id(object.data["id"])
+ assert activity.data["id"]
+
{:ok, object_again} = ActivityPub.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
assert [attachment] = object.data["attachment"]
@@ -276,6 +278,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
assert object == object_again
end
+
+ test "it works with objects only available via Ostatus" do
+ {:ok, object} = ActivityPub.fetch_object_from_id("https://shitposter.club/notice/2827873")
+ assert activity = Activity.get_create_activity_by_object_ap_id(object.data["id"])
+ assert activity.data["id"]
+
+ {:ok, object_again} = ActivityPub.fetch_object_from_id("https://shitposter.club/notice/2827873")
+
+ assert object == object_again
+ end
end
describe "following / unfollowing" do
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs
index 11c6bbe1c..96dd63057 100644
--- a/test/web/activity_pub/transmogrifier_test.exs
+++ b/test/web/activity_pub/transmogrifier_test.exs
@@ -22,6 +22,21 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
assert activity == returned_activity
end
+ test "it fetches replied-to activities if we don't have them" do
+ data = File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Poison.decode!
+
+ object = data["object"]
+ |> Map.put("inReplyTo", "https://shitposter.club/notice/2827873")
+
+ data = data
+ |> Map.put("object", object)
+
+ {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
+
+ assert Activity.get_create_activity_by_object_ap_id("tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment")
+ end
+
test "it works for incoming notices" do
data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!