Skip to content

Commit

Permalink
fix: debug tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evemartin committed Apr 4, 2024
1 parent dd8b086 commit a1f0674
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 36 deletions.
41 changes: 8 additions & 33 deletions cfl_common/common/tests/utils/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
from builtins import str


def follow_verify_email_link_to_onboarding(page, email):
_follow_verify_email_link(page, email)
def follow_verify_email_link_to_onboarding(page, url):
page.browser.get(url)

return go_to_teacher_login_page(page.browser)


def follow_verify_email_link_to_teacher_dashboard(page, email):
_follow_verify_email_link(page, email)

return go_to_teacher_dashboard_page(page.browser)


def follow_verify_email_link_to_login(page, email, user_type):
# _follow_verify_email_link(page, email)
page.browser.get(email)
def follow_verify_email_link_to_login(page, url, user_type):
page.browser.get(url)

if user_type == "teacher":
return go_to_teacher_login_page(page.browser)
Expand All @@ -33,15 +26,6 @@ def follow_duplicate_account_link_to_login(page, email, user_type):
return go_to_independent_student_login_page(page.browser)


def _follow_verify_email_link(page, email):
message = str(email.message())
prefix = '<p>Please go to <a href="'
i = str.find(message, prefix) + len(prefix)
suffix = '" rel="nofollow">'
j = str.find(message, suffix, i)
page.browser.get(message[i:j])


def _follow_duplicate_account_email_link(page, email):
message = str(email.message())
prefix = 'please login: <a href="'
Expand All @@ -61,27 +45,18 @@ def follow_reset_email_link(browser, email):
return PasswordResetPage(browser)


def follow_change_email_link_to_dashboard(page, email):
page.browser.get(email)
def follow_change_email_link_to_dashboard(page, url):
page.browser.get(url)

return go_to_teacher_login_page(page.browser)


def follow_change_email_link_to_independent_dashboard(page, email):
page.browser.get(email)
def follow_change_email_link_to_independent_dashboard(page, url):
page.browser.get(url)

return go_to_independent_student_login_page(page.browser)


def _follow_change_email_link(page, email):
message = str(email.message())
prefix = "please go to "
i = str.find(message, prefix) + len(prefix)
suffix = " to verify"
j = str.find(message, suffix, i)
page.browser.get(message[i:j])


def go_to_teacher_login_page(browser):
from portal.tests.pageObjects.portal.teacher_login_page import TeacherLoginPage

Expand Down
8 changes: 5 additions & 3 deletions cfl_common/common/tests/utils/teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def signup_duplicate_teacher_fail(page, duplicate_email):
return page, email_address, password


def signup_teacher(page, newsletter=False):
@patch("common.helpers.emails.send_dotdigital_email")
def signup_teacher(page, mock_send_dotdigital_email, newsletter=False):
page = page.go_to_signup_page()

first_name, last_name, email_address, password = generate_details()
Expand All @@ -57,8 +58,9 @@ def signup_teacher(page, newsletter=False):

page = page.return_to_home_page()

page = email.follow_verify_email_link_to_onboarding(page, mail.outbox[0])
mail.outbox = []
verification_url = mock_send_dotdigital_email.call_args.kwargs["personalization_values"]["VERIFICATION_LINK"]

page = email.follow_verify_email_link_to_onboarding(page, verification_url)

return page, email_address, password

Expand Down

0 comments on commit a1f0674

Please sign in to comment.