Skip to content

Commit

Permalink
fix: failing password reset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sohailfatima committed May 21, 2024
1 parent bceac7d commit b94fb78
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -146,7 +146,6 @@ def test_password_reset_ratelimited_for_non_existing_user(self):
for non-existing user.
"""
self.assert_password_reset_ratelimitted('[email protected]', AnonymousUser())
self.assert_no_events_were_emitted()

@patch(
'openedx.core.djangoapps.user_authn.views.password_reset.render_to_string',
Expand Down

0 comments on commit b94fb78

Please sign in to comment.