summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2021-09-22 16:26:22 -0400
committerTusooa Zhu <tusooa@kazv.moe>2021-12-28 01:11:08 -0500
commiteb383ef8d366c1656494278dfe6d2a6afdc04bc6 (patch)
tree1b4ec2ca84b5bf15e92c328278b85a177ab970f3 /test
parenta677c621e822673b3b2922d5b0975f704f2f59a7 (diff)
downloadpleroma-eb383ef8d366c1656494278dfe6d2a6afdc04bc6.tar.gz
pleroma-eb383ef8d366c1656494278dfe6d2a6afdc04bc6.zip
Make move_account endpoint process non-existent users properly
Ref: emit-move
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/twitter_api/util_controller_test.exs19
-rw-r--r--test/support/http_request_mock.ex9
2 files changed, 28 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 40fcadb72..7f4a343ff 100644
--- a/test/pleroma/web/twitter_api/util_controller_test.exs
+++ b/test/pleroma/web/twitter_api/util_controller_test.exs
@@ -573,6 +573,25 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
}
end
+ test "with proper permissions, valid password and target account does not exist",
+ %{
+ conn: conn
+ } do
+ target_nick = "not_found@mastodon.social"
+
+ conn =
+ conn
+ |> put_req_header("content-type", "multipart/form-data")
+ |> post("/api/pleroma/move_account", %{
+ "password" => "test",
+ "target_account" => target_nick
+ })
+
+ assert json_response_and_validate_schema(conn, 404) == %{
+ "error" => "Target account not found."
+ }
+ end
+
test "with proper permissions, valid password and target account aliases this", %{
conn: conn,
user: user
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
index 94900dc14..7d5ebd2de 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -725,6 +725,15 @@ defmodule HttpRequestMock do
}}
end
+ def get(
+ "https://mastodon.social/.well-known/webfinger?resource=acct:not_found@mastodon.social",
+ _,
+ _,
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
+ ) do
+ {:ok, %Tesla.Env{status: 404}}
+ end
+
def get("http://gs.example.org/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{