summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2022-05-05 19:20:32 -0400
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2022-05-06 10:23:26 +0200
commit57c030a0a729f0ee87330d231ca6fb1151840a43 (patch)
tree247860702c4740c19586a296520425e05a5fa03b /test
parente2d24eda5745310346b5e347efddbc68723612f0 (diff)
downloadpleroma-57c030a0a729f0ee87330d231ca6fb1151840a43.tar.gz
pleroma-57c030a0a729f0ee87330d231ca6fb1151840a43.zip
Skip cache when /objects or /activities is authenticated
Ref: fix-local-public
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/activity_pub_controller_test.exs24
1 files changed, 24 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 1923ec479..1c5c40e84 100644
--- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
@@ -291,6 +291,30 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert json_response(conn, 200) == ObjectView.render("object.json", %{object: note})
end
+ test "does not cache authenticated response", %{conn: conn} do
+ user = insert(:user)
+ reader = insert(:user)
+
+ {:ok, post} =
+ CommonAPI.post(user, %{status: "test @#{reader.nickname}", visibility: "local"})
+
+ object = Object.normalize(post, fetch: false)
+ uuid = String.split(object.data["id"], "/") |> List.last()
+
+ assert response =
+ conn
+ |> assign(:user, reader)
+ |> put_req_header("accept", "application/activity+json")
+ |> get("/objects/#{uuid}")
+
+ json_response(response, 200)
+
+ conn
+ |> put_req_header("accept", "application/activity+json")
+ |> get("/objects/#{uuid}")
+ |> json_response(404)
+ end
+
test "it returns 404 for non-public messages", %{conn: conn} do
note = insert(:direct_note)
uuid = String.split(note.data["id"], "/") |> List.last()