aboutsummaryrefslogtreecommitdiff
path: root/test/pleroma
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2021-12-28 15:01:37 -0500
committerTusooa Zhu <tusooa@kazv.moe>2022-08-20 21:13:51 -0400
commit27016287862a93b1fb4a4bebda3199e32c46d962 (patch)
tree188b3fcc53909e0f6d560578aef798ec2317f4d2 /test/pleroma
parent6ccab516a3f62682fe15f8efec36be82acafc155 (diff)
downloadpleroma-27016287862a93b1fb4a4bebda3199e32c46d962.tar.gz
Add remote interaction ui for posts
Diffstat (limited to 'test/pleroma')
-rw-r--r--test/pleroma/web/twitter_api/util_controller_test.exs64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs
index 5dc72b177..020a5e9a1 100644
--- a/test/pleroma/web/twitter_api/util_controller_test.exs
+++ b/test/pleroma/web/twitter_api/util_controller_test.exs
@@ -233,6 +233,70 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
end
end
+ describe "POST /main/ostatus - remote_subscribe/2 - with statuses" do
+ setup do: clear_config([:instance, :federating], true)
+
+ test "renders subscribe form", %{conn: conn} do
+ user = insert(:user)
+ status = insert(:note_activity, %{user: user})
+ status_id = status.id
+
+ assert is_binary(status_id)
+
+ response =
+ conn
+ |> post("/main/ostatus", %{"status_id" => status_id, "profile" => ""})
+ |> response(:ok)
+
+ refute response =~ "Could not find status"
+ assert response =~ "Interacting with"
+ end
+
+ test "renders subscribe form with error when status not found", %{conn: conn} do
+ response =
+ conn
+ |> post("/main/ostatus", %{"status_id" => "somerandomid", "profile" => ""})
+ |> response(:ok)
+
+ assert response =~ "Could not find status"
+ refute response =~ "Interacting with"
+ end
+
+ test "it redirect to webfinger url", %{conn: conn} do
+ user = insert(:user)
+ status = insert(:note_activity, %{user: user})
+ status_id = status.id
+ status_ap_id = status.data["object"]
+
+ assert is_binary(status_id)
+ assert is_binary(status_ap_id)
+
+ user2 = insert(:user, ap_id: "shp@social.heldscal.la")
+
+ conn =
+ conn
+ |> post("/main/ostatus", %{
+ "status" => %{"status_id" => status_id, "profile" => user2.ap_id}
+ })
+
+ assert redirected_to(conn) ==
+ "https://social.heldscal.la/main/ostatussub?profile=#{status_ap_id}"
+ end
+
+ test "it renders form with error when status not found", %{conn: conn} do
+ user2 = insert(:user, ap_id: "shp@social.heldscal.la")
+
+ response =
+ conn
+ |> post("/main/ostatus", %{
+ "status" => %{"status_id" => "somerandomid", "profile" => user2.ap_id}
+ })
+ |> response(:ok)
+
+ assert response =~ "Something went wrong."
+ end
+ end
+
test "it returns new captcha", %{conn: conn} do
with_mock Pleroma.Captcha,
new: fn -> "test_captcha" end do