summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-12-26 02:33:28 +0000
committerAlex Gleason <alex@alexgleason.me>2021-12-26 02:33:28 +0000
commit0eb6e858f7e11f4caec5ee19234b4751be83dea8 (patch)
tree2a970bc5a40385175e1358c287d386e981616997 /test
parent73609211a425922a5068d3912a36b82abe24e12c (diff)
parent2c06eff519f63e67aada70d492094e6e56bbfccd (diff)
downloadpleroma-0eb6e858f7e11f4caec5ee19234b4751be83dea8.tar.gz
pleroma-0eb6e858f7e11f4caec5ee19234b4751be83dea8.zip
Merge branch 'notice-routes' into 'develop'
Add notice compatibility routes for other frontends Closes #1785 See merge request pleroma/pleroma!3402
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/o_status/o_status_controller_test.exs50
-rw-r--r--test/pleroma/web/plugs/frontend_static_plug_test.exs2
2 files changed, 52 insertions, 0 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 81d669837..41aef98b1 100644
--- a/test/pleroma/web/o_status/o_status_controller_test.exs
+++ b/test/pleroma/web/o_status/o_status_controller_test.exs
@@ -343,4 +343,54 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
|> response(200)
end
end
+
+ describe "notice compatibility routes" do
+ test "Soapbox FE", %{conn: conn} do
+ user = insert(:user)
+ note_activity = insert(:note_activity, user: user)
+
+ resp =
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/@#{user.nickname}/posts/#{note_activity.id}")
+ |> response(200)
+
+ expected =
+ "<meta content=\"#{Endpoint.url()}/notice/#{note_activity.id}\" property=\"og:url\">"
+
+ assert resp =~ expected
+ end
+
+ test "Mastodon", %{conn: conn} do
+ user = insert(:user)
+ note_activity = insert(:note_activity, user: user)
+
+ resp =
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/@#{user.nickname}/#{note_activity.id}")
+ |> response(200)
+
+ expected =
+ "<meta content=\"#{Endpoint.url()}/notice/#{note_activity.id}\" property=\"og:url\">"
+
+ assert resp =~ expected
+ end
+
+ test "Twitter", %{conn: conn} do
+ user = insert(:user)
+ note_activity = insert(:note_activity, user: user)
+
+ resp =
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/#{user.nickname}/status/#{note_activity.id}")
+ |> response(200)
+
+ expected =
+ "<meta content=\"#{Endpoint.url()}/notice/#{note_activity.id}\" property=\"og:url\">"
+
+ assert resp =~ expected
+ end
+ end
end
diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs
index 52379b86a..4b3925ad2 100644
--- a/test/pleroma/web/plugs/frontend_static_plug_test.exs
+++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs
@@ -86,6 +86,8 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do
"objects",
"activities",
"notice",
+ "@:nickname",
+ ":nickname",
"users",
"tags",
"mailer",