only include JS when feature flag is on and the course has proctoring enabled
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
This test file will run through some LMS test scenarios regarding access and navigation of the LMS
|
||||
"""
|
||||
import time
|
||||
from mock import patch
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
from django.conf import settings
|
||||
@@ -12,6 +13,7 @@ from courseware.tests.helpers import LoginEnrollmentTestCase
|
||||
from courseware.tests.factories import GlobalStaffFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
|
||||
@attr('shard_1')
|
||||
@@ -266,3 +268,45 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
kwargs={'course_id': test_course_id}
|
||||
)
|
||||
self.assert_request_status_code(302, url)
|
||||
|
||||
def test_proctoring_js_includes(self):
|
||||
"""
|
||||
Make sure that proctoring JS does not get included on
|
||||
courseware pages if either the FEATURE flag is turned off
|
||||
or the course is not proctored enabled
|
||||
"""
|
||||
|
||||
email, password = self.STUDENT_INFO[0]
|
||||
self.login(email, password)
|
||||
self.enroll(self.test_course, True)
|
||||
|
||||
test_course_id = self.test_course.id.to_deprecated_string()
|
||||
|
||||
with patch.dict(settings.FEATURES, {'ENABLE_PROCTORED_EXAMS': False}):
|
||||
url = reverse(
|
||||
'courseware',
|
||||
kwargs={'course_id': test_course_id}
|
||||
)
|
||||
resp = self.client.get(url)
|
||||
|
||||
self.assertNotContains(resp, '/static/js/lms-proctoring.js')
|
||||
|
||||
with patch.dict(settings.FEATURES, {'ENABLE_PROCTORED_EXAMS': True}):
|
||||
url = reverse(
|
||||
'courseware',
|
||||
kwargs={'course_id': test_course_id}
|
||||
)
|
||||
resp = self.client.get(url)
|
||||
|
||||
self.assertNotContains(resp, '/static/js/lms-proctoring.js')
|
||||
|
||||
# now set up a course which is proctored enabled
|
||||
|
||||
self.test_course.enable_proctored_exams = True
|
||||
self.test_course.save()
|
||||
|
||||
modulestore().update_item(self.test_course, self.user.id)
|
||||
|
||||
resp = self.client.get(url)
|
||||
|
||||
self.assertContains(resp, '/static/js/lms-proctoring.js')
|
||||
|
||||
@@ -33,9 +33,9 @@ specific_student_selected = selected(not staff_selected and masquerade.user_name
|
||||
student_selected = selected(not staff_selected and not specific_student_selected and not masquerade_group_id)
|
||||
include_proctoring = settings.FEATURES.get('ENABLE_PROCTORED_EXAMS', False) and course.enable_proctored_exams
|
||||
%>
|
||||
<%static:js group='proctoring'/>
|
||||
|
||||
% if include_proctoring:
|
||||
<%static:js group='proctoring'/>
|
||||
% for template_name in ["proctored-exam-status"]:
|
||||
<script type="text/template" id="${template_name}-tpl">
|
||||
<%static:include path="courseware/${template_name}.underscore" />
|
||||
|
||||
@@ -58,7 +58,7 @@ git+https://github.com/edx/ecommerce-api-client.git@1.1.0#egg=ecommerce-api-clie
|
||||
-e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client
|
||||
-e git+https://github.com/edx/edx-organizations.git@release-2015-08-03#egg=edx-organizations
|
||||
|
||||
git+https://github.com/edx/edx-proctoring.git@release-2015-08-18#egg=edx-proctoring==0.6.0
|
||||
git+https://github.com/edx/edx-proctoring.git@0.6.2#egg=edx-proctoring==0.6.2
|
||||
|
||||
# Third Party XBlocks
|
||||
-e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga
|
||||
|
||||
Reference in New Issue
Block a user