-
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.
- Loading branch information
Showing
2 changed files
with
41 additions
and
3 deletions.
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
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 |
---|---|---|
|
@@ -167,7 +167,7 @@ def test_post_reset_password(flask_app): | |
assert logout_response.status_code == 204 | ||
|
||
|
||
def test_post_reset_password_is_not_same_old(flask_app): | ||
def test_post_reset_password_invalidation(flask_app): | ||
""" | ||
Given a Flask application configured for testing | ||
WHEN the '/auth/password/reset-password' endpoint is requested (POST) | ||
|
@@ -191,8 +191,8 @@ def test_post_reset_password_is_not_same_old(flask_app): | |
"/auth/reset-password", | ||
json={ | ||
"token": token, | ||
"confirm_password": "uniquepassword4testing!", | ||
"new_password": "uniquepassword4testing!", | ||
"confirm_password": "invalidatepassword4testing!", | ||
"new_password": "invalidatepassword4testing!", | ||
}, | ||
) | ||
|
||
|
@@ -207,6 +207,38 @@ def test_post_reset_password_is_not_same_old(flask_app): | |
}, | ||
) | ||
|
||
assert reset_response_old.status_code == 400 | ||
|
||
|
||
def test_post_reset_password_is_not_same_old(flask_app): | ||
""" | ||
Given a Flask application configured for testing | ||
WHEN the '/auth/password/reset-password' endpoint is requested (POST) | ||
THEN check that the response is valid and the password is changed | ||
""" | ||
_test_client = flask_app.test_client() | ||
|
||
forgot_response = _test_client.post( | ||
"/auth/forgot-password", | ||
json={ | ||
"email_address": "[email protected]", | ||
|
||
}, | ||
) | ||
assert forgot_response.status_code == 200 | ||
|
||
token = forgot_response.headers["X-Token"] | ||
assert token is not None | ||
|
||
reset_response_old = _test_client.post( | ||
"/auth/reset-password", | ||
json={ | ||
"token": token, | ||
"confirm_password": "invalidatepassword4testing!", | ||
"new_password": "invalidatepassword4testing!", | ||
}, | ||
) | ||
|
||
assert reset_response_old.status_code == 422 | ||
|
||
|
||
|