diff options
author | lain <lain@soykaf.club> | 2020-08-03 15:00:14 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-03 15:00:14 +0200 |
commit | de3bdc63adac0141500bdc2692124cd104330bda (patch) | |
tree | ac154430e44e64500570c24643bb2e90cd2ef7c4 | |
parent | dc88b6f0919cf5686af7d5b935e8ee462491704b (diff) | |
download | pleroma-de3bdc63adac0141500bdc2692124cd104330bda.tar.gz |
AccountControllerTest: Add test for message returned.
-rw-r--r-- | test/web/mastodon_api/controllers/account_controller_test.exs | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/web/mastodon_api/controllers/account_controller_test.exs index d390c3ce1..2cb388655 100644 --- a/test/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/web/mastodon_api/controllers/account_controller_test.exs @@ -940,17 +940,32 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do assert refresh 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 = build_conn() |> put_req_header("content-type", "multipart/form-data") |> put_req_header("authorization", "Bearer " <> token) - |> post("/api/v1/accounts", %{ - username: "lain", - email: "lain@example.org", - password: "PlzDontHackLain", - bio: "Test Bio", - agreement: true - }) + |> post("/api/v1/accounts", params) + + assert %{"error" => "{\"email\":[\"Email domain is blacklisted\"]}"} = + json_response_and_validate_schema(conn, 400) + + 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, |