Make move_account endpoint process non-existent users properly

Ref: emit-move
This commit is contained in:
Tusooa Zhu 2021-09-22 16:26:22 -04:00
commit eb383ef8d3
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 50 additions and 4 deletions

View file

@ -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

View file

@ -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{