diff options
author | lain <lain@soykaf.club> | 2020-08-04 11:00:30 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-04 11:00:30 +0000 |
commit | 28584bb2241c600fc6150fdae49b1eea6bd420e0 (patch) | |
tree | 18f8334bdd3daffed7b033492539e3b867e8d15f /test/web/mastodon_api/controllers/account_controller_test.exs | |
parent | e3953923aca1706ab508bfda1ab892304b29c09a (diff) | |
parent | 2f4289d455fbd2d949ac1e10d5ea2b9c78f15e82 (diff) | |
download | pleroma-28584bb2241c600fc6150fdae49b1eea6bd420e0.tar.gz pleroma-28584bb2241c600fc6150fdae49b1eea6bd420e0.zip |
Merge branch 'email-blacklist' into 'develop'
Add email blacklist, fixes #1404
Closes #1404
See merge request pleroma/pleroma!2837
Diffstat (limited to 'test/web/mastodon_api/controllers/account_controller_test.exs')
-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..17a1e7d66 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\":[\"Invalid email\"]}"} = + 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, |