-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: tests for logging in user after password changes
- Loading branch information
Showing
1 changed file
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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 |