- 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 = Activity.get_create_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"]
- assert is_list(attachment["url"])
-
- 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_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
-
- test "it correctly stitches up conversations between ostatus and ap" do
- last = "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
- {:ok, object} = ActivityPub.fetch_object_from_id(last)
+ describe "fetch the latest Follow" do
+ test "fetches the latest Follow activity" do
+ %Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)
+ follower = Repo.get_by(User, ap_id: activity.data["actor"])
+ followed = Repo.get_by(User, ap_id: activity.data["object"])