summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2021-02-03 17:53:09 +0100
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2021-02-04 15:17:40 +0100
commitecff02741817e5622da58365855dce09c789ca83 (patch)
tree97cd0a0bcb9651c1232d3289423e97ac61db914b /test
parentfd2477dfba1f167c7519a029bedd7ae6884a9f1d (diff)
Redirect non-local activities when /notice/:id is used
Related-to: https://git.pleroma.social/pleroma/pleroma/-/issues/2496
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/o_status/o_status_controller_test.exs16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs
index 5cdca019a..2038f4ddd 100644
--- a/test/pleroma/web/o_status/o_status_controller_test.exs
+++ b/test/pleroma/web/o_status/o_status_controller_test.exs
@@ -144,13 +144,19 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
assert redirect_url == expected_redirect_url
end
- test "returns a 404 on remote notice when json requested", %{conn: conn} do
+ test "redirects to a proper object URL when json requested and the object is remote", %{
+ conn: conn
+ } do
note_activity = insert(:note_activity, local: false)
+ expected_redirect_url = Object.normalize(note_activity, fetch: false).data["id"]
- conn
- |> put_req_header("accept", "application/activity+json")
- |> get("/notice/#{note_activity.id}")
- |> response(404)
+ redirect_url =
+ conn
+ |> put_req_header("accept", "application/activity+json")
+ |> get("/notice/#{note_activity.id}")
+ |> redirected_to()
+
+ assert redirect_url == expected_redirect_url
end
test "500s when actor not found", %{conn: conn} do