From b94fb78ee6c6a7281fd2a3417c4f0a97ce67f852 Mon Sep 17 00:00:00 2001 From: sohailfatima <23100065@lums.edu.pk> Date: Tue, 21 May 2024 14:44:52 +0500 Subject: [PATCH] fix: failing password reset tests --- .../user_authn/views/tests/test_reset_password.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py b/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py index 7e7202750465..b89b458ed1ae 100644 --- a/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py +++ b/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py @@ -33,7 +33,7 @@ from openedx.core.djangoapps.user_api.tests.test_views import UserAPITestCase from openedx.core.djangoapps.user_api.accounts import EMAIL_MAX_LENGTH, EMAIL_MIN_LENGTH from openedx.core.djangoapps.user_authn.views.password_reset import ( - SETTING_CHANGE_INITIATED, password_reset, LogistrationPasswordResetView, + SETTING_CHANGE_INITIATED, PASSWORD_RESET_INITIATED, password_reset, LogistrationPasswordResetView, PasswordResetConfirmWrapper, password_change_request_handler) from openedx.core.djangolib.testing.utils import CacheIsolationTestCase from common.djangoapps.student.tests.factories import TEST_PASSWORD, UserFactory @@ -114,7 +114,7 @@ def test_user_bad_password_reset(self): assert bad_pwd_resp.status_code == 200 obj = json.loads(bad_pwd_resp.content.decode('utf-8')) assert obj == {'success': True, 'value': "('registration/password_reset_done.html', [])"} - self.assert_no_events_were_emitted() + self.assert_event_emission_count(PASSWORD_RESET_INITIATED, 1) @patch( 'openedx.core.djangoapps.user_authn.views.password_reset.render_to_string', @@ -134,7 +134,7 @@ def test_nonexist_email_password_reset(self): assert bad_email_resp.status_code == 200 obj = json.loads(bad_email_resp.content.decode('utf-8')) assert obj == {'success': True, 'value': "('registration/password_reset_done.html', [])"} - self.assert_no_events_were_emitted() + self.assert_event_emission_count(PASSWORD_RESET_INITIATED, 1) @patch( 'openedx.core.djangoapps.user_authn.views.password_reset.render_to_string', @@ -146,7 +146,6 @@ def test_password_reset_ratelimited_for_non_existing_user(self): for non-existing user. """ self.assert_password_reset_ratelimitted('thisdoesnotexist@foo.com', AnonymousUser()) - self.assert_no_events_were_emitted() @patch( 'openedx.core.djangoapps.user_authn.views.password_reset.render_to_string',