AccountControllerTest: Add test for message returned.

This commit is contained in:
lain 2020-08-03 15:00:14 +02:00
parent dc88b6f091
commit de3bdc63ad

View File

@ -940,17 +940,32 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
assert refresh assert refresh
assert scope == "read write follow" assert scope == "read write follow"
clear_config([User, :email_blacklist], ["example.org"])
params = %{
username: "lain",
email: "lain@example.org",
password: "PlzDontHackLain",
bio: "Test Bio",
agreement: true
}
conn = conn =
build_conn() build_conn()
|> put_req_header("content-type", "multipart/form-data") |> put_req_header("content-type", "multipart/form-data")
|> put_req_header("authorization", "Bearer " <> token) |> put_req_header("authorization", "Bearer " <> token)
|> post("/api/v1/accounts", %{ |> post("/api/v1/accounts", params)
username: "lain",
email: "lain@example.org", assert %{"error" => "{\"email\":[\"Email domain is blacklisted\"]}"} =
password: "PlzDontHackLain", json_response_and_validate_schema(conn, 400)
bio: "Test Bio",
agreement: true Pleroma.Config.put([User, :email_blacklist], [])
})
conn =
build_conn()
|> put_req_header("content-type", "multipart/form-data")
|> put_req_header("authorization", "Bearer " <> token)
|> post("/api/v1/accounts", params)
%{ %{
"access_token" => token, "access_token" => token,