ActivityPubControllerTest: Testing changes.

This commit is contained in:
lain 2020-06-23 11:43:20 +02:00
parent 2737809bbf
commit d93e01137b

View File

@ -648,11 +648,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
test "it accepts announces with to as string instead of array", %{conn: conn} do test "it accepts announces with to as string instead of array", %{conn: conn} do
user = insert(:user) user = insert(:user)
{:ok, post} = CommonAPI.post(user, %{status: "hey"})
announcer = insert(:user, local: false)
data = %{ data = %{
"@context" => "https://www.w3.org/ns/activitystreams", "@context" => "https://www.w3.org/ns/activitystreams",
"actor" => "http://mastodon.example.org/users/admin", "actor" => announcer.ap_id,
"id" => "http://mastodon.example.org/users/admin/statuses/19512778738411822/activity", "id" => "#{announcer.ap_id}/statuses/19512778738411822/activity",
"object" => "https://mastodon.social/users/emelie/statuses/101849165031453009", "object" => post.data["object"],
"to" => "https://www.w3.org/ns/activitystreams#Public", "to" => "https://www.w3.org/ns/activitystreams#Public",
"cc" => [user.ap_id], "cc" => [user.ap_id],
"type" => "Announce" "type" => "Announce"
@ -665,7 +668,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|> post("/users/#{user.nickname}/inbox", data) |> post("/users/#{user.nickname}/inbox", data)
assert "ok" == json_response(conn, 200) assert "ok" == json_response(conn, 200)
ObanHelpers.perform_all() ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
%Activity{} = activity = Activity.get_by_ap_id(data["id"]) %Activity{} = activity = Activity.get_by_ap_id(data["id"])
assert "https://www.w3.org/ns/activitystreams#Public" in activity.recipients assert "https://www.w3.org/ns/activitystreams#Public" in activity.recipients
end end