Commit e090d557 by zubair-arbi

fix quality for xss_lint

parent 9d217f5d
...@@ -44,6 +44,7 @@ from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin ...@@ -44,6 +44,7 @@ from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme_context from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme_context
from openedx.core.djangoapps.user_api.accounts.api import activate_account, create_account from openedx.core.djangoapps.user_api.accounts.api import activate_account, create_account
from openedx.core.djangolib.js_utils import dump_js_escaped_json from openedx.core.djangolib.js_utils import dump_js_escaped_json
from openedx.core.djangolib.markup import HTML, Text
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from student_account.views import account_settings_context, get_user_orders from student_account.views import account_settings_context, get_user_orders
...@@ -539,23 +540,23 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -539,23 +540,23 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
with mock.patch('edxmako.request_context.get_current_request', return_value=request): with mock.patch('edxmako.request_context.get_current_request', return_value=request):
response = login_and_registration_form(request) response = login_and_registration_form(request)
expected_providers = [] expected_error_message = Text(_(
expected_error_message = _( u'We are sorry, you are not authorized to access {platform_name} via this channel. '
u'We are sorry, you are not authorized to access {platform_name} ' u'Please contact your {enterprise} administrator in order to access {platform_name} '
u'via this channel. Please contact your {enterprise} administrator in ' u'or contact {edx_support_link}.{line_break}'
u'order to access {platform_name} or contact {link_start}edX Support{link_end}.' u'{line_break}'
u'{line_break}{line_break}' u'Error Details:{line_break}{error_message}')
u'Error Details:{line_break}' ).format(
u'{error_message}'.format( platform_name=settings.PLATFORM_NAME,
platform_name=settings.PLATFORM_NAME, enterprise=enterprise_customer_data['name'],
enterprise=enterprise_customer_data['name'], error_message=dummy_error_message,
error_message=dummy_error_message, edx_support_link=HTML(
link_start='<a href="{edx_support_url}">'.format( '<a href="{edx_support_url}">{support_url_name}</a>'
edx_support_url=settings.SUPPORT_SITE_LINK ).format(
), edx_support_url=settings.SUPPORT_SITE_LINK,
link_end='</a>', support_url_name=_('edX Support'),
line_break='<br/>' ),
) line_break=HTML('<br/>')
) )
self._assert_saml_auth_data_with_error( self._assert_saml_auth_data_with_error(
response, response,
......
...@@ -37,6 +37,7 @@ from openedx.core.djangoapps.user_api.errors import ( ...@@ -37,6 +37,7 @@ from openedx.core.djangoapps.user_api.errors import (
UserNotFound, UserNotFound,
UserAPIInternalError UserAPIInternalError
) )
from openedx.core.djangolib.markup import HTML, Text
from openedx.core.lib.edx_api_utils import get_edx_api_data from openedx.core.lib.edx_api_utils import get_edx_api_data
from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES
from openedx.features.enterprise_support.api import enterprise_customer_for_request, get_enterprise_learner_data from openedx.features.enterprise_support.api import enterprise_customer_for_request, get_enterprise_learner_data
...@@ -381,23 +382,25 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None): ...@@ -381,23 +382,25 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None):
break break
if enterprise_customer and context['errorMessage']: if enterprise_customer and context['errorMessage']:
context['errorMessage'] = _( context['errorMessage'] = Text(_(
u'We are sorry, you are not authorized to access {platform_name} via this channel. ' u'We are sorry, you are not authorized to access {platform_name} via this channel. '
u'Please contact your {enterprise} administrator in order to access {platform_name} ' u'Please contact your {enterprise} administrator in order to access {platform_name} '
u'or contact {link_start}edX Support{link_end}.{line_break}' u'or contact {edx_support_link}.{line_break}'
u'{line_break}' u'{line_break}'
u'Error Details:{line_break}{error_message}'.format( u'Error Details:{line_break}{error_message}')
platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), ).format(
enterprise=enterprise_customer['name'], platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
error_message=context['errorMessage'], enterprise=enterprise_customer['name'],
link_start='<a href="{edx_support_url}">'.format( error_message=context['errorMessage'],
edx_support_url=configuration_helpers.get_value( edx_support_link=HTML(
'SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK '<a href="{edx_support_url}">{support_url_name}</a>'
) ).format(
edx_support_url=configuration_helpers.get_value(
'SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK
), ),
link_end='</a>', support_url_name=_('edX Support'),
line_break='<br/>' ),
) line_break=HTML('<br/>')
) )
return context return context
......
Markdown is supported
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