diff options
| author | Alex Gleason <alex@alexgleason.me> | 2020-10-08 15:44:48 -0500 |
|---|---|---|
| committer | Alex Gleason <alex@alexgleason.me> | 2020-10-08 15:44:48 -0500 |
| commit | 77b1ea68a7700ac4a78c7f2e0ea9f118441d23da (patch) | |
| tree | 06243af101a609256b517f48175380a7c4f5bfbb /test/web/mastodon_api/controllers/auth_controller_test.exs | |
| parent | 4af1b803811cbb59d41f0149706d6dda340b4755 (diff) | |
| parent | 74be4de3f6c2c34447029649526637411acfa9f3 (diff) | |
| download | pleroma-77b1ea68a7700ac4a78c7f2e0ea9f118441d23da.tar.gz pleroma-77b1ea68a7700ac4a78c7f2e0ea9f118441d23da.zip | |
Merge remote-tracking branch 'upstream/develop' into aliases
Diffstat (limited to 'test/web/mastodon_api/controllers/auth_controller_test.exs')
| -rw-r--r-- | test/web/mastodon_api/controllers/auth_controller_test.exs | 25 |
1 files changed, 16 insertions, 9 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..bf2438fe2 100644 --- a/test/web/mastodon_api/controllers/auth_controller_test.exs +++ b/test/web/mastodon_api/controllers/auth_controller_test.exs @@ -61,7 +61,7 @@ defmodule Pleroma.Web.MastodonAPI.AuthControllerTest do end test "it returns 204", %{conn: conn} do - assert json_response(conn, :no_content) + assert empty_json_response(conn) end test "it creates a PasswordResetToken record for user", %{user: user} do @@ -91,7 +91,7 @@ defmodule Pleroma.Web.MastodonAPI.AuthControllerTest do assert conn |> post("/auth/password?nickname=#{user.nickname}") - |> json_response(:no_content) + |> empty_json_response() ObanHelpers.perform_all() token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id) @@ -112,7 +112,7 @@ defmodule Pleroma.Web.MastodonAPI.AuthControllerTest do assert conn |> post("/auth/password?nickname=#{user.nickname}") - |> json_response(:no_content) + |> empty_json_response() end end @@ -122,17 +122,24 @@ 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 empty_json_response(conn) 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 empty_json_response(conn) + 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 empty_json_response(conn) end end |
