Skip to content
Snippets Groups Projects
Commit 4af929fb authored by Jillian Vogel's avatar Jillian Vogel
Browse files

Fixes test failures

parent 761acdfc
Branches
Tags release-2021-09-02-16.48
No related merge requests found
...@@ -121,32 +121,29 @@ class TestActivateAccount(TestCase): ...@@ -121,32 +121,29 @@ class TestActivateAccount(TestCase):
""" """
# Log in with test user. # Log in with test user.
self.login() self.login()
expected_message = render_to_string( expected_message = (
'registration/account_activation_sidebar_notice.html', u"Check your {email_start}{email}{email_end} inbox for an account activation link from "
{ u"{platform_name}. If you need help, contact {link_start}{platform_name} Support{link_end}."
'email': self.user.email, ).format(
'platform_name': self.platform_name, platform_name=self.platform_name,
'activation_email_support_link': self.activation_email_support_link email_start="<strong>",
} email_end="</strong>",
email=self.user.email,
link_start="<a target='_blank' href='{activation_email_support_link}'>".format(
activation_email_support_link=self.activation_email_support_link,
),
link_end="</a>",
) )
response = self.client.get(reverse('dashboard')) response = self.client.get(reverse('dashboard'))
self.assertContains(response, expected_message, html=True) self.assertContains(response, expected_message)
# Now make sure account activation message goes away when user activated the account # Now make sure account activation message goes away when user activated the account
self.user.is_active = True self.user.is_active = True
self.user.save() self.user.save()
self.login() self.login()
expected_message = render_to_string(
'registration/account_activation_sidebar_notice.html',
{
'email': self.user.email,
'platform_name': self.platform_name,
'activation_email_support_link': self.activation_email_support_link
}
)
response = self.client.get(reverse('dashboard')) response = self.client.get(reverse('dashboard'))
self.assertNotContains(response, expected_message, html=True) self.assertNotContains(response, expected_message)
def test_account_activation_notification_on_logistration(self): def test_account_activation_notification_on_logistration(self):
""" """
......
...@@ -611,17 +611,17 @@ def student_dashboard(request): ...@@ -611,17 +611,17 @@ def student_dashboard(request):
activate_account_message = '' activate_account_message = ''
if not user.is_active: if not user.is_active:
activate_account_message = Text(_( activate_account_message = Text(_(
"Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. " "Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. "
"If you need help, contact {link_start}{platform_name} Support{link_end}." "If you need help, contact {link_start}{platform_name} Support{link_end}."
)).format( )).format(
platform_name=platform_name, platform_name=platform_name,
email_start=HTML("<strong>"), email_start=HTML("<strong>"),
email_end=HTML("</strong>"), email_end=HTML("</strong>"),
email=user.email, email=user.email,
link_start=HTML("<a target='_blank' href='{activation_email_support_link}'>").format( link_start=HTML("<a target='_blank' href='{activation_email_support_link}'>").format(
activation_email_support_link=activation_email_support_link, activation_email_support_link=activation_email_support_link,
), ),
link_end=HTML("</a>"), link_end=HTML("</a>"),
) )
enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments) enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments)
...@@ -819,7 +819,7 @@ def student_dashboard(request): ...@@ -819,7 +819,7 @@ def student_dashboard(request):
'disable_courseware_js': True, 'disable_courseware_js': True,
'display_course_modes_on_dashboard': enable_verified_certificates and display_course_modes_on_dashboard, 'display_course_modes_on_dashboard': enable_verified_certificates and display_course_modes_on_dashboard,
'display_sidebar_on_dashboard': display_sidebar_on_dashboard, 'display_sidebar_on_dashboard': display_sidebar_on_dashboard,
'display_sidebar_account_activation_message': (not user.is_active and not hide_dashboard_courses_until_activated), 'display_sidebar_account_activation_message': not(user.is_active or hide_dashboard_courses_until_activated),
'display_dashboard_courses': (user.is_active or not hide_dashboard_courses_until_activated), 'display_dashboard_courses': (user.is_active or not hide_dashboard_courses_until_activated),
'empty_dashboard_message': empty_dashboard_message, 'empty_dashboard_message': empty_dashboard_message,
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment