diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2022-05-09 15:20:53 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-05-09 18:53:32 -0400 |
commit | 6e5ef7f2eb40a337107b94611bf10143f94d3d49 (patch) | |
tree | 206652fe0737bd061b6454f42daa5faa69840d6c | |
parent | 38444aa92a4ae89065c138f0f0110bef4fe48ace (diff) | |
download | pleroma-6e5ef7f2eb40a337107b94611bf10143f94d3d49.tar.gz pleroma-6e5ef7f2eb40a337107b94611bf10143f94d3d49.zip |
Test local-only in ap c2s outbox
Ref: fix-local-public
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_controller_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index b52c8e52e..ef91066c1 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1318,6 +1318,35 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do assert outbox_endpoint == result["id"] end + test "it returns a local note activity when authenticated as local user", %{conn: conn} do + user = insert(:user) + reader = insert(:user) + {:ok, note_activity} = CommonAPI.post(user, %{status: "mew mew", visibility: "local"}) + ap_id = note_activity.data["id"] + + resp = + conn + |> assign(:user, reader) + |> put_req_header("accept", "application/activity+json") + |> get("/users/#{user.nickname}/outbox?page=true") + |> json_response(200) + + assert %{"orderedItems" => [%{"id" => ^ap_id}]} = resp + end + + test "it does not return a local note activity when unauthenticated", %{conn: conn} do + user = insert(:user) + {:ok, _note_activity} = CommonAPI.post(user, %{status: "mew mew", visibility: "local"}) + + resp = + conn + |> put_req_header("accept", "application/activity+json") + |> get("/users/#{user.nickname}/outbox?page=true") + |> json_response(200) + + assert %{"orderedItems" => []} = resp + end + test "it returns a note activity in a collection", %{conn: conn} do note_activity = insert(:note_activity) note_object = Object.normalize(note_activity, fetch: false) |