Skip to content

Commit

Permalink
✨ feat: tests for logging in user after password changes
Browse files Browse the repository at this point in the history
  • Loading branch information
slugb0t committed Dec 20, 2023
1 parent 56117d5 commit 369180a
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion tests/functional/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_post_password_change(clients):
WHEN the '/auth/password/change' endpoint is requested (PUT)
THEN check that the response is valid and the password is changed
"""
_logged_in_client, _admin_client, _editor_client, _viewer_client = clients
_logged_in_client = clients[0]

response = _logged_in_client.post(
"/auth/password/change",
Expand All @@ -20,3 +20,39 @@ def test_post_password_change(clients):
)

assert response.status_code == 200


def test_post_password_login_invalid_old_password(clients):
"""
Given a Flask application configured for testing
WHEN the '/auth/login' endpoint is requested (POST)
THEN check that the response is an error when old password is provided
"""
_logged_in_client = clients[0]
response = _logged_in_client.post(
"/auth/login",
json={
"email_address": "[email protected]",
"password": "Testingyeshello11!",
},
)

assert response.status_code == 401


def test_post_login_new_password(clients):
"""
Given a Flask application configured for testing
WHEN the '/auth/login' endpoint is requested (POST)
THEN check that the response is valid when new password is provided
"""
_logged_in_client = clients[0]
response = _logged_in_client.post(
"/auth/login",
json={
"email_address": "[email protected]",
"password": "Updatedpassword4testing!",
},
)

assert response.status_code == 200

0 comments on commit 369180a

Please sign in to comment.