Fix tests for users and highscores
This commit is contained in:
@@ -46,7 +46,7 @@ async def test_register_without_username_should_fail():
|
||||
json={"password": password, "avatar_index": avatar_index},
|
||||
)
|
||||
|
||||
assert response.status_code == 422
|
||||
assert response.status_code == 400
|
||||
assert "access_token" not in response.json()
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ async def test_register_without_password_should_fail():
|
||||
json={"username": username, "avatar_index": avatar_index},
|
||||
)
|
||||
|
||||
assert response.status_code == 422
|
||||
assert response.status_code == 400
|
||||
assert "access_token" not in response.json()
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ async def test_register_without_avatar_should_fail():
|
||||
json={"username": username, "password": password},
|
||||
)
|
||||
|
||||
# Not ideal that this is 400 instead of 422, but had no other choice than to give this field a default value
|
||||
assert response.status_code == 400
|
||||
assert "access_token" not in response.json()
|
||||
|
||||
@@ -115,7 +114,7 @@ async def test_login_wrong_password_should_fail():
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_login_without_username_should_fail():
|
||||
"""Test whether logging in without passing a username fails"""
|
||||
"""Test whether logging in without passing a username fails, since the default is an empty string"""
|
||||
clear_db()
|
||||
await register_user()
|
||||
|
||||
@@ -125,13 +124,13 @@ async def test_login_without_username_should_fail():
|
||||
json={"password": password},
|
||||
)
|
||||
|
||||
assert response.status_code == 422
|
||||
assert response.status_code == 401
|
||||
assert "access_token" not in response.json()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_login_without_password_should_fail():
|
||||
"""Test whether logging in without passing a password fails"""
|
||||
"""Test whether logging in without passing a password fails, since the default is an empty string"""
|
||||
clear_db()
|
||||
await register_user()
|
||||
|
||||
@@ -141,5 +140,5 @@ async def test_login_without_password_should_fail():
|
||||
json={"username": username},
|
||||
)
|
||||
|
||||
assert response.status_code == 422
|
||||
assert response.status_code == 401
|
||||
assert "access_token" not in response.json()
|
||||
|
||||
Reference in New Issue
Block a user