2121 MSG_LOGGED_IN ,
2222 MSG_OFTEN_RESET_PASSWORD ,
2323 MSG_PASSWORD_CHANGED ,
24- MSG_UNKNOWN_EMAIL ,
2524 MSG_USER_BANNED ,
2625 MSG_USER_EXPIRED ,
2726)
@@ -68,6 +67,7 @@ async def test_reset_password_two_steps_action_confirmation_workflow(
6867 assert response .url .path == reset_url .path
6968 await assert_status (response , status .HTTP_200_OK , MSG_EMAIL_SENT .format (** user ))
7069
70+ # Email is printed in the out
7171 out , _ = capsys .readouterr ()
7272 confirmation_url = parse_link (out )
7373 code = URL (confirmation_url ).parts [- 1 ]
@@ -119,6 +119,7 @@ async def test_reset_password_two_steps_action_confirmation_workflow(
119119async def test_unknown_email (
120120 client : TestClient ,
121121 capsys : pytest .CaptureFixture ,
122+ caplog : pytest .LogCaptureFixture ,
122123 fake_user_email : str ,
123124):
124125 assert client .app
@@ -135,8 +136,16 @@ async def test_unknown_email(
135136 response , status .HTTP_200_OK , MSG_EMAIL_SENT .format (email = fake_user_email )
136137 )
137138
139+ # email is not sent
138140 out , _ = capsys .readouterr ()
139- assert parse_test_marks (out )["reason" ] == MSG_UNKNOWN_EMAIL
141+ assert not parse_test_marks (out )
142+
143+ # Check logger warning
144+ assert any (
145+ record .levelname == "WARNING"
146+ and record .message .startswith ("Password reset initiated" )
147+ for record in caplog .records
148+ )
140149
141150
142151@pytest .mark .parametrize (
0 commit comments