diff options
author | feld <feld@feld.me> | 2020-09-02 17:11:24 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2020-09-02 17:11:24 +0000 |
commit | d1a6f67b1d92e17f4fe3cfc8f296879326897220 (patch) | |
tree | 50fbbe1bf517ab94bd9ce6047f147a3d13f51798 /test | |
parent | 0ab03e856480c35ce9478d086f103b396a8e7453 (diff) | |
parent | cbf7f0e02943f44a73f4418b8c6a8bada06331d8 (diff) | |
download | pleroma-d1a6f67b1d92e17f4fe3cfc8f296879326897220.tar.gz pleroma-d1a6f67b1d92e17f4fe3cfc8f296879326897220.zip |
Merge branch 'fix/2095-deactivated-account-reset' into 'develop'
Disallow password resets for deactivated accounts
Closes #2095
See merge request pleroma/pleroma!2935
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/auth_controller_test.exs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/web/mastodon_api/controllers/auth_controller_test.exs b/test/web/mastodon_api/controllers/auth_controller_test.exs index a485f8e41..4fa95fce1 100644 --- a/test/web/mastodon_api/controllers/auth_controller_test.exs +++ b/test/web/mastodon_api/controllers/auth_controller_test.exs @@ -122,17 +122,27 @@ defmodule Pleroma.Web.MastodonAPI.AuthControllerTest do {:ok, user: user} end - test "it returns 404 when user is not found", %{conn: conn, user: user} do + test "it returns 204 when user is not found", %{conn: conn, user: user} do conn = post(conn, "/auth/password?email=nonexisting_#{user.email}") - assert conn.status == 404 - assert conn.resp_body == "" + + assert conn + |> json_response(:no_content) end - test "it returns 400 when user is not local", %{conn: conn, user: user} do + test "it returns 204 when user is not local", %{conn: conn, user: user} do {:ok, user} = Repo.update(Ecto.Changeset.change(user, local: false)) conn = post(conn, "/auth/password?email=#{user.email}") - assert conn.status == 400 - assert conn.resp_body == "" + + assert conn + |> json_response(:no_content) + end + + test "it returns 204 when user is deactivated", %{conn: conn, user: user} do + {:ok, user} = Repo.update(Ecto.Changeset.change(user, deactivated: true, local: true)) + conn = post(conn, "/auth/password?email=#{user.email}") + + assert conn + |> json_response(:no_content) end end |