Fix MastoAPI.AuthControllerTest, json_response(:no_content) --> empty_json_response()
This commit is contained in:
parent
0b728ccc44
commit
bf181ca968
|
@ -61,7 +61,7 @@ test "redirects to the getting-started page when referer is not present", %{conn
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns 204", %{conn: conn} do
|
test "it returns 204", %{conn: conn} do
|
||||||
assert json_response(conn, :no_content)
|
assert empty_json_response(conn)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it creates a PasswordResetToken record for user", %{user: user} do
|
test "it creates a PasswordResetToken record for user", %{user: user} do
|
||||||
|
@ -91,7 +91,7 @@ test "it returns 204", %{conn: conn} do
|
||||||
|
|
||||||
assert conn
|
assert conn
|
||||||
|> post("/auth/password?nickname=#{user.nickname}")
|
|> post("/auth/password?nickname=#{user.nickname}")
|
||||||
|> json_response(:no_content)
|
|> empty_json_response()
|
||||||
|
|
||||||
ObanHelpers.perform_all()
|
ObanHelpers.perform_all()
|
||||||
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
|
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
|
||||||
|
@ -112,7 +112,7 @@ test "it doesn't fail when a user has no email", %{conn: conn} do
|
||||||
|
|
||||||
assert conn
|
assert conn
|
||||||
|> post("/auth/password?nickname=#{user.nickname}")
|
|> post("/auth/password?nickname=#{user.nickname}")
|
||||||
|> json_response(:no_content)
|
|> empty_json_response()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -125,24 +125,21 @@ test "it doesn't fail when a user has no email", %{conn: conn} do
|
||||||
test "it returns 204 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}")
|
conn = post(conn, "/auth/password?email=nonexisting_#{user.email}")
|
||||||
|
|
||||||
assert conn
|
assert empty_json_response(conn)
|
||||||
|> json_response(:no_content)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns 204 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))
|
{:ok, user} = Repo.update(Ecto.Changeset.change(user, local: false))
|
||||||
conn = post(conn, "/auth/password?email=#{user.email}")
|
conn = post(conn, "/auth/password?email=#{user.email}")
|
||||||
|
|
||||||
assert conn
|
assert empty_json_response(conn)
|
||||||
|> json_response(:no_content)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns 204 when user is deactivated", %{conn: conn, user: user} do
|
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))
|
{:ok, user} = Repo.update(Ecto.Changeset.change(user, deactivated: true, local: true))
|
||||||
conn = post(conn, "/auth/password?email=#{user.email}")
|
conn = post(conn, "/auth/password?email=#{user.email}")
|
||||||
|
|
||||||
assert conn
|
assert empty_json_response(conn)
|
||||||
|> json_response(:no_content)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue