X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Factivity_pub%2Factivity_pub_test.exs;h=e6cc20bbaddaa6257d419b71c9a50341144716ce;hb=b5d06a3db85a87b29b6a239cd6af1369177306fb;hp=a5f971bbbaadf8cb24d7907f064a554f94a03038;hpb=0f132b802dde7f217ecb07767e0d34e3edb517b7;p=akkoma diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index a5f971bbb..e6cc20bba 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -347,6 +347,39 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do assert Map.has_key?(data, "http://inserted") end + test "fetches user featured when it has string IDs" do + featured_url = "https://example.com/alisaie/collections/featured" + dead_url = "https://example.com/users/alisaie/statuses/108311386746229284" + + featured_data = + "test/fixtures/mastodon/featured_collection.json" + |> File.read!() + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^featured_url + } -> + %Tesla.Env{ + status: 200, + body: featured_data, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^dead_url + } -> + %Tesla.Env{ + status: 404, + body: "{}", + headers: [{"content-type", "application/activity+json"}] + } + end) + + {:ok, %{}} = ActivityPub.fetch_and_prepare_featured_from_ap_id(featured_url) + end + test "it fetches the appropriate tag-restricted posts" do user = insert(:user)