'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'

def test_proctoring_js_includes(self):

    (email, password) = self.STUDENT_INFO[0]
    self.login(email, password)
    self.enroll(self.test_course_proctored, True)
    test_course_id = self.test_course_proctored.id.to_deprecated_string()
    with patch.dict(settings.FEATURES, {'ENABLE_SPECIAL_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_SPECIAL_EXAMS': True}):
        url = reverse('courseware', kwargs={'course_id': test_course_id})
        resp = self.client.get(url)
        self.assertNotContains(resp, '/static/js/lms-proctoring.js')
        self.test_course_proctored.enable_proctored_exams = True
        self.test_course_proctored.save()
        modulestore().update_item(self.test_course_proctored, self.user.id)
        resp = self.client.get(url)
        self.assertContains(resp, '/static/js/lms-proctoring.js')
