diff --git a/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py b/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py
index dd79a53310..df4e0a2455 100644
--- a/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py
+++ b/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py
@@ -3,9 +3,8 @@
End-to-end tests for the LMS Instructor Dashboard.
"""
-import time
+import ddt
-from flaky import flaky
from nose.plugins.attrib import attr
from bok_choy.promise import EmptyPromise
@@ -652,6 +651,7 @@ class DataDownloadsTest(BaseInstructorDashboardTest):
@attr('shard_7')
+@ddt.ddt
class CertificatesTest(BaseInstructorDashboardTest):
"""
Tests for Certificates functionality on instructor dashboard.
@@ -907,6 +907,36 @@ class CertificatesTest(BaseInstructorDashboardTest):
self.certificates_section.message.text
)
+ @ddt.data(
+ ('Test \nNotes', 'Test Notes'),
+ ('Notes', 'Notes'),
+ )
+ @ddt.unpack
+ def test_notes_escaped_in_add_certificate_exception(self, notes, expected_notes):
+ """
+ Scenario: On the Certificates tab of the Instructor Dashboard, Instructor can add new certificate
+ exception to list.
+
+ Given that I am on the Certificates tab on the Instructor Dashboard
+ When I fill in student username and notes (which contains character which are needed to be escaped)
+ and click 'Add Exception' button, then new certificate exception should be visible in
+ certificate exceptions list.
+ """
+ # Add a student to Certificate exception list
+ self.certificates_section.add_certificate_exception(self.user_name, notes)
+ self.assertIn(self.user_name, self.certificates_section.last_certificate_exception.text)
+ self.assertIn(expected_notes, self.certificates_section.last_certificate_exception.text)
+
+ # Revisit Page & verify that added exceptions are also synced with backend
+ self.certificates_section.refresh()
+
+ # Wait for the certificate exception section to render
+ self.certificates_section.wait_for_certificate_exceptions_section()
+
+ # Validate certificate exception synced with server is visible in certificate exceptions list
+ self.assertIn(self.user_name, self.certificates_section.last_certificate_exception.text)
+ self.assertIn(expected_notes, self.certificates_section.last_certificate_exception.text)
+
@attr('shard_7')
class CertificateInvalidationTest(BaseInstructorDashboardTest):
diff --git a/lms/static/js/certificates/factories/certificate_whitelist_factory.js b/lms/static/js/certificates/factories/certificate_whitelist_factory.js
index 267c63a9f2..b008e85316 100644
--- a/lms/static/js/certificates/factories/certificate_whitelist_factory.js
+++ b/lms/static/js/certificates/factories/certificate_whitelist_factory.js
@@ -16,7 +16,7 @@
return function(certificate_white_list_json, generate_certificate_exceptions_url,
certificate_exception_view_url, generate_bulk_certificate_exceptions_url){
- var certificateWhiteList = new CertificateWhiteListCollection(JSON.parse(certificate_white_list_json), {
+ var certificateWhiteList = new CertificateWhiteListCollection(certificate_white_list_json, {
parse: true,
canBeEmpty: true,
url: certificate_exception_view_url,
diff --git a/lms/templates/instructor/instructor_dashboard_2/certificates.html b/lms/templates/instructor/instructor_dashboard_2/certificates.html
index 1c599355bb..8b4f4a3fc5 100644
--- a/lms/templates/instructor/instructor_dashboard_2/certificates.html
+++ b/lms/templates/instructor/instructor_dashboard_2/certificates.html
@@ -7,7 +7,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str
%>
<%static:require_module module_name="js/certificates/factories/certificate_whitelist_factory" class_name="CertificateWhitelistFactory">
- CertificateWhitelistFactory('${certificate_white_list | n, dump_js_escaped_json}', '${generate_certificate_exceptions_url | n, js_escaped_string}', '${certificate_exception_view_url | n, js_escaped_string}', '${generate_bulk_certificate_exceptions_url | n, js_escaped_string}');
+ CertificateWhitelistFactory(${certificate_white_list | n, dump_js_escaped_json}, '${generate_certificate_exceptions_url | n, js_escaped_string}', '${certificate_exception_view_url | n, js_escaped_string}', '${generate_bulk_certificate_exceptions_url | n, js_escaped_string}');
%static:require_module>
<%static:require_module module_name="js/certificates/factories/certificate_invalidation_factory" class_name="CertificateInvalidationFactory">