diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2022-05-06 08:19:03 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2022-05-06 08:19:03 +0000 |
commit | b22843a98247cf683764759f3e447845f3fcedf8 (patch) | |
tree | 970a1d0515c784b7fc00a2934b8494badb569d85 /test/pleroma/web/activity_pub/activity_pub_controller_test.exs | |
parent | 62a45747d90c2ad400373650b9c03693acfa7708 (diff) | |
parent | 57c486014c06715ff5cd5ad4361155d4a1776c23 (diff) |
Merge branch 'security/2.4.3' into 'stable'v2.4.3
Release: 2.4.3
See merge request pleroma/pleroma!3662
Diffstat (limited to 'test/pleroma/web/activity_pub/activity_pub_controller_test.exs')
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_controller_test.exs | 24 |
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 50315e21f..511405624 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() |