Skip to content

Commit 979e834

Browse files
committed
fixes tests
1 parent 5af9ac1 commit 979e834

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

services/web/server/tests/unit/with_dbs/03/login/test_login_reset_password.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
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(
119119
async 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

Comments
 (0)