-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move reset password email (#2281)
* fix: move verification emails to Dotdigital * Merge branch 'master' into move-verification-emails-to-dotdigital * fix: fix dotdigital email tests * fix: fix parent email test * fix: add github secret binding * fix: add chrome to dev container * fix: attempt to fix under 13 test * fix: attempt to fix patching * fix: continue work on updating tests * fix: continue to update tests * fix: fix package names * fix: fix test assert * fix: fix assert * fix: update tests * fix: rearrange decorators * fix: continue work on tests * fix: fix typo * fix: testing something out * fix: testing something out * fix: undo chrome changes * fix: adding additional mocks * fix: debug tests * fix: debug tests * fix: debug tests * fix: debug tests * fix: debug tests * fix: debug tests * fix: debug tests * fix: debug tests * fix: debug tests * fix: add forgotten import * fix: update dotdigital auth * fix: fix environmental variable * fix: address PR comments * fix: address PR comments * fix: debug tests * fix: debug tests * fix: tidy code, replace verification reminder emails * fix: fix verification reminder email tests * fix: debug tests * fix: debug tests * fix: fix patch mock * fix: move reset password email * fix: tidy code * fix: remove old code * fix: debug tests * fix: debug tests * fix: debug tests * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Merge branch 'master' into move-reset-password-email * fix: tidy code * fix: tidy code * Merge branch 'master' into move-reset-password-email * fix: address PR comments * Merge branch 'master' into move-reset-password-email Co-Authored-By: Florian Aucomte <[email protected]>
- Loading branch information
1 parent
fec326b
commit e00604f
Showing
7 changed files
with
58 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,17 +284,22 @@ def test_login_not_verified(self, mock_send_dotdigital_email): | |
|
||
assert self.is_dashboard(page) | ||
|
||
def test_reset_password(self): | ||
@patch("portal.forms.registration.send_dotdigital_email") | ||
def test_reset_password(self, mock_send_dotdigital_email: Mock): | ||
page = self.go_to_homepage() | ||
|
||
page, name, username, _, _ = create_independent_student(page) | ||
page = self.get_to_forgotten_password_page() | ||
|
||
page.reset_email_submit(username) | ||
|
||
self.wait_for_email() | ||
mock_send_dotdigital_email.assert_called_with(campaign_ids["reset_password"], ANY, personalization_values=ANY) | ||
|
||
page = email_utils.follow_reset_email_link(self.selenium, mail.outbox[0]) | ||
reset_password_url = mock_send_dotdigital_email.call_args.kwargs["personalization_values"][ | ||
"RESET_PASSWORD_LINK" | ||
] | ||
|
||
page = email_utils.follow_reset_email_link(self.selenium, reset_password_url) | ||
|
||
new_password = "AnotherPassword12" | ||
|
||
|
@@ -312,14 +317,13 @@ def test_reset_password(self): | |
page = page.go_to_account_page() | ||
assert page.check_account_details({"name": name}) | ||
|
||
def test_reset_password_fail(self): | ||
@patch("portal.forms.registration.send_dotdigital_email") | ||
def test_reset_password_fail(self, mock_send_dotdigital_email: Mock): | ||
page = self.get_to_forgotten_password_page() | ||
fake_email = "[email protected]" | ||
page.reset_email_submit(fake_email) | ||
|
||
time.sleep(5) | ||
|
||
assert len(mail.outbox) == 0 | ||
mock_send_dotdigital_email.assert_not_called() | ||
|
||
def test_update_name_success(self): | ||
homepage = self.go_to_homepage() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -628,7 +628,8 @@ def test_change_password(self): | |
|
||
assert self.is_dashboard_page(page) | ||
|
||
def test_reset_password(self): | ||
@patch("portal.forms.registration.send_dotdigital_email") | ||
def test_reset_password(self, mock_send_dotdigital_email: Mock): | ||
email, _ = signup_teacher_directly() | ||
create_organisation_directly(email) | ||
_, _, access_code = create_class_directly(email) | ||
|
@@ -638,9 +639,13 @@ def test_reset_password(self): | |
|
||
page.reset_email_submit(email) | ||
|
||
self.wait_for_email() | ||
mock_send_dotdigital_email.assert_called_with(campaign_ids["reset_password"], ANY, personalization_values=ANY) | ||
|
||
page = email_utils.follow_reset_email_link(self.selenium, mail.outbox[0]) | ||
reset_password_url = mock_send_dotdigital_email.call_args.kwargs["personalization_values"][ | ||
"RESET_PASSWORD_LINK" | ||
] | ||
|
||
page = email_utils.follow_reset_email_link(self.selenium, reset_password_url) | ||
|
||
new_password = "AnotherPassword12!" | ||
|
||
|
@@ -650,7 +655,8 @@ def test_reset_password(self): | |
page = HomePage(self.selenium).go_to_teacher_login_page().login(email, new_password) | ||
assert self.is_dashboard_page(page) | ||
|
||
def test_reset_with_same_password(self): | ||
@patch("portal.forms.registration.send_dotdigital_email") | ||
def test_reset_with_same_password(self, mock_send_dotdigital_email: Mock): | ||
email, password = signup_teacher_directly() | ||
create_organisation_directly(email) | ||
_, _, access_code = create_class_directly(email) | ||
|
@@ -660,23 +666,26 @@ def test_reset_with_same_password(self): | |
|
||
page.reset_email_submit(email) | ||
|
||
self.wait_for_email() | ||
mock_send_dotdigital_email.assert_called_with(campaign_ids["reset_password"], ANY, personalization_values=ANY) | ||
|
||
reset_password_url = mock_send_dotdigital_email.call_args.kwargs["personalization_values"][ | ||
"RESET_PASSWORD_LINK" | ||
] | ||
|
||
page = email_utils.follow_reset_email_link(self.selenium, mail.outbox[0]) | ||
page = email_utils.follow_reset_email_link(self.selenium, reset_password_url) | ||
|
||
page.reset_password_fail(password) | ||
|
||
message = page.browser.find_element(By.CLASS_NAME, "errorlist") | ||
assert "Please choose a password that you haven't used before" in message.text | ||
|
||
def test_reset_password_fail(self): | ||
@patch("portal.forms.registration.send_dotdigital_email") | ||
def test_reset_password_fail(self, mock_send_dotdigital_email: Mock): | ||
page = self.get_to_forgotten_password_page() | ||
fake_email = "[email protected]" | ||
page.reset_email_submit(fake_email) | ||
|
||
time.sleep(5) | ||
|
||
assert len(mail.outbox) == 0 | ||
mock_send_dotdigital_email.assert_not_called() | ||
|
||
def test_admin_sees_all_school_classes(self): | ||
email, password = signup_teacher_directly() | ||
|