Commit 1799634c by Awais Jibran Committed by Adam Palay

Fix certificate exception view.

ECOM-3910
parent a254d754
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
End-to-end tests for the LMS Instructor Dashboard. End-to-end tests for the LMS Instructor Dashboard.
""" """
import time import ddt
from flaky import flaky
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from bok_choy.promise import EmptyPromise from bok_choy.promise import EmptyPromise
...@@ -652,6 +651,7 @@ class DataDownloadsTest(BaseInstructorDashboardTest): ...@@ -652,6 +651,7 @@ class DataDownloadsTest(BaseInstructorDashboardTest):
@attr('shard_7') @attr('shard_7')
@ddt.ddt
class CertificatesTest(BaseInstructorDashboardTest): class CertificatesTest(BaseInstructorDashboardTest):
""" """
Tests for Certificates functionality on instructor dashboard. Tests for Certificates functionality on instructor dashboard.
...@@ -907,6 +907,36 @@ class CertificatesTest(BaseInstructorDashboardTest): ...@@ -907,6 +907,36 @@ class CertificatesTest(BaseInstructorDashboardTest):
self.certificates_section.message.text self.certificates_section.message.text
) )
@ddt.data(
('Test \nNotes', 'Test Notes'),
('<Test>Notes</Test>', '<Test>Notes</Test>'),
)
@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') @attr('shard_7')
class CertificateInvalidationTest(BaseInstructorDashboardTest): class CertificateInvalidationTest(BaseInstructorDashboardTest):
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
return function(certificate_white_list_json, generate_certificate_exceptions_url, return function(certificate_white_list_json, generate_certificate_exceptions_url,
certificate_exception_view_url, generate_bulk_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, parse: true,
canBeEmpty: true, canBeEmpty: true,
url: certificate_exception_view_url, url: certificate_exception_view_url,
......
...@@ -7,7 +7,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str ...@@ -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"> <%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>
<%static:require_module module_name="js/certificates/factories/certificate_invalidation_factory" class_name="CertificateInvalidationFactory"> <%static:require_module module_name="js/certificates/factories/certificate_invalidation_factory" class_name="CertificateInvalidationFactory">
......
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