aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-26 16:27:39 +0200
committerlain <lain@soykaf.club>2020-06-26 16:27:39 +0200
commita5bbfa21a1fabe97bfff1cc80348d2944319f3ad (patch)
treefea8447a7e51412a26e98dcb621b5df4e5054923 /test
parent6db9f7cdb3adeda547b6e3e9ca887b685344351a (diff)
downloadpleroma-a5bbfa21a1fabe97bfff1cc80348d2944319f3ad.tar.gz
StaticFE: Prioritize json in requests.
Diffstat (limited to 'test')
-rw-r--r--test/web/static_fe/static_fe_controller_test.exs14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/web/static_fe/static_fe_controller_test.exs b/test/web/static_fe/static_fe_controller_test.exs
index a49ab002f..1598bf675 100644
--- a/test/web/static_fe/static_fe_controller_test.exs
+++ b/test/web/static_fe/static_fe_controller_test.exs
@@ -87,6 +87,20 @@ defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do
assert html =~ "testing a thing!"
end
+ test "redirects to json if requested", %{conn: conn, user: user} do
+ {:ok, activity} = CommonAPI.post(user, %{status: "testing a thing!"})
+
+ conn =
+ conn
+ |> put_req_header(
+ "accept",
+ "Accept: application/activity+json, application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\", text/html"
+ )
+ |> get("/notice/#{activity.id}")
+
+ assert redirected_to(conn, 302) =~ activity.data["object"]
+ end
+
test "filters HTML tags", %{conn: conn} do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "<script>alert('xss')</script>"})