forked from Github-Mirrors/canaille
tests: fix assertions on the compromission password tests
This commit is contained in:
parent
6fa86cb5b2
commit
0af36824cb
2 changed files with 8 additions and 5 deletions
|
@ -229,7 +229,7 @@ def test_profile_settings_compromised_password_request_api_failed_but_password_u
|
|||
|
||||
@mock.patch("requests.api.get")
|
||||
def test_compromised_password_validator_with_failure_of_api_request_and_success_mail_to_admin_from_settings_form(
|
||||
api_get, testclient, backend, user, logged_user, caplog
|
||||
api_get, testclient, backend, user, logged_user, caplog, smtpd
|
||||
):
|
||||
current_app.config["CANAILLE"]["ENABLE_PASSWORD_COMPROMISSION_CHECK"] = True
|
||||
api_get.side_effect = mock.Mock(side_effect=Exception())
|
||||
|
@ -252,15 +252,16 @@ def test_compromised_password_validator_with_failure_of_api_request_and_success_
|
|||
"Password compromise investigation failed. Please contact the administrators.",
|
||||
) in res.flashes
|
||||
assert (
|
||||
"success",
|
||||
"info",
|
||||
"We have informed your administrator about the failure of the password compromise investigation.",
|
||||
) in res.flashes
|
||||
assert ("success", "Profile updated successfully.") in res.flashes
|
||||
assert len(smtpd.messages) == 1
|
||||
|
||||
|
||||
@mock.patch("requests.api.get")
|
||||
def test_compromised_password_validator_with_failure_of_api_request_and_fail_to_send_mail_to_admin_from_settings_form(
|
||||
api_get, testclient, backend, user, logged_user, caplog
|
||||
api_get, testclient, backend, user, logged_user, caplog, smtpd
|
||||
):
|
||||
current_app.config["CANAILLE"]["ENABLE_PASSWORD_COMPROMISSION_CHECK"] = True
|
||||
api_get.side_effect = mock.Mock(side_effect=Exception())
|
||||
|
@ -289,6 +290,7 @@ def test_compromised_password_validator_with_failure_of_api_request_and_fail_to_
|
|||
"If this still happens, please contact the administrators.",
|
||||
) in res.flashes
|
||||
assert ("success", "Profile updated successfully.") in res.flashes
|
||||
assert len(smtpd.messages) == 0
|
||||
|
||||
|
||||
@mock.patch("requests.api.get")
|
||||
|
|
|
@ -221,7 +221,7 @@ def test_registration_with_compromised_password_request_api_failed_but_account_c
|
|||
|
||||
@mock.patch("requests.api.get")
|
||||
def test_compromised_password_validator_with_failure_of_api_request_and_success_mail_to_admin_from_register_form(
|
||||
api_get, testclient, backend, caplog
|
||||
api_get, testclient, backend, caplog, smtpd
|
||||
):
|
||||
current_app.config["CANAILLE"]["ENABLE_PASSWORD_COMPROMISSION_CHECK"] = True
|
||||
api_get.side_effect = mock.Mock(side_effect=Exception())
|
||||
|
@ -249,10 +249,11 @@ def test_compromised_password_validator_with_failure_of_api_request_and_success_
|
|||
"Password compromise investigation failed. Please contact the administrators.",
|
||||
) in res.flashes
|
||||
assert (
|
||||
"success",
|
||||
"info",
|
||||
"We have informed your administrator about the failure of the password compromise investigation.",
|
||||
) in res.flashes
|
||||
assert ("success", "Your account has been created successfully.") in res.flashes
|
||||
assert len(smtpd.messages) == 1
|
||||
|
||||
user = backend.get(models.User, user_name="newuser")
|
||||
assert user
|
||||
|
|
Loading…
Reference in a new issue