diff options
author | lain <lain@soykaf.club> | 2019-11-13 17:37:48 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-11-13 17:37:48 +0000 |
commit | f74bb1d0fc123ba8616d81a80dcf5d64b25aa4ed (patch) | |
tree | f4ea2ac9c1477e701fe75040bafcd0e13e8671d7 /test | |
parent | 60cc5a775084fbd9362b7e682887d0c44caf5175 (diff) | |
parent | 3c60adbc1f773c732458d68b4becaf9bb36d7062 (diff) | |
download | pleroma-f74bb1d0fc123ba8616d81a80dcf5d64b25aa4ed.tar.gz |
Merge branch 'static-fe-object-id' into 'develop'
Redirect object/activity ID to notice in static-fe
Closes #1412
See merge request pleroma/pleroma!1977
Diffstat (limited to 'test')
-rw-r--r-- | test/web/static_fe/static_fe_controller_test.exs | 29 |
1 files changed, 29 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 b8fb67b22..2ce8f9fa3 100644 --- a/test/web/static_fe/static_fe_controller_test.exs +++ b/test/web/static_fe/static_fe_controller_test.exs @@ -1,5 +1,6 @@ defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do use Pleroma.Web.ConnCase + alias Pleroma.Activity alias Pleroma.Web.ActivityPub.Transmogrifier alias Pleroma.Web.CommonAPI @@ -128,6 +129,34 @@ defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do assert html =~ "voyages" end + test "redirect by AP object ID", %{conn: conn} do + user = insert(:user) + + {:ok, %Activity{data: %{"object" => object_url}}} = + CommonAPI.post(user, %{"status" => "beam me up"}) + + conn = + conn + |> put_req_header("accept", "text/html") + |> get(URI.parse(object_url).path) + + assert html_response(conn, 302) =~ "redirected" + end + + test "redirect by activity ID", %{conn: conn} do + user = insert(:user) + + {:ok, %Activity{data: %{"id" => id}}} = + CommonAPI.post(user, %{"status" => "I'm a doctor, not a devops!"}) + + conn = + conn + |> put_req_header("accept", "text/html") + |> get(URI.parse(id).path) + + assert html_response(conn, 302) =~ "redirected" + end + test "404 when notice not found", %{conn: conn} do conn = conn |