Hide the exam review dashboard unless the proctoring backend supports the feature.
This commit is contained in:
@@ -3,8 +3,13 @@ Unit tests for Edx Proctoring feature flag in new instructor dashboard.
|
||||
"""
|
||||
|
||||
import ddt
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
|
||||
from edx_proctoring.api import create_exam
|
||||
from edx_proctoring.backends.tests.test_backend import TestBackendProvider
|
||||
|
||||
from mock import patch
|
||||
from six import text_type
|
||||
|
||||
@@ -89,7 +94,9 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase):
|
||||
# verify that proctoring tab is visible for course instructor
|
||||
CourseStaffRole(self.course.id).remove_users(self.instructor)
|
||||
CourseInstructorRole(self.course.id).add_users(self.instructor)
|
||||
self._assert_proctoring_tab_is_available()
|
||||
response = self._assert_proctoring_tab_is_available()
|
||||
# the default backend does not support the review dashboard
|
||||
self.assertNotIn('Review Dashboard', response.content)
|
||||
|
||||
@ddt.data(
|
||||
(True, False),
|
||||
@@ -130,6 +137,24 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase):
|
||||
self.assertNotIn(self.proctoring_link, response.content)
|
||||
self.assertNotIn('Allowance Section', response.content)
|
||||
|
||||
def test_review_dashboard(self):
|
||||
"""
|
||||
The exam review dashboard will appear for backends that support the feature
|
||||
"""
|
||||
self.setup_course(True, True)
|
||||
backend = TestBackendProvider()
|
||||
config = apps.get_app_config('edx_proctoring')
|
||||
with patch.object(config, 'backends', {'test': backend}):
|
||||
create_exam(
|
||||
course_id=self.course.id,
|
||||
content_id='test_content',
|
||||
exam_name='Final Test Exam',
|
||||
time_limit_mins=10,
|
||||
backend='test',
|
||||
)
|
||||
response = self._assert_proctoring_tab_is_available()
|
||||
self.assertIn('Review Dashboard', response.content)
|
||||
|
||||
def _assert_proctoring_tab_is_available(self):
|
||||
"""
|
||||
Asserts that proctoring tab is available for logged in user.
|
||||
@@ -137,3 +162,4 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase):
|
||||
response = self.client.get(self.url)
|
||||
self.assertIn(self.proctoring_link, response.content)
|
||||
self.assertIn('Allowance Section', response.content)
|
||||
return response
|
||||
|
||||
@@ -310,13 +310,15 @@ def _section_e_commerce(course, access, paid_mode, coupons_enabled, reports_enab
|
||||
|
||||
def _section_special_exams(course, access):
|
||||
""" Provide data for the corresponding dashboard section """
|
||||
course_key = course.id
|
||||
course_key = unicode(course.id)
|
||||
from edx_proctoring.api import is_backend_dashboard_available
|
||||
|
||||
section_data = {
|
||||
'section_key': 'special_exams',
|
||||
'section_display_name': _('Special Exams'),
|
||||
'access': access,
|
||||
'course_id': unicode(course_key)
|
||||
'course_id': course_key,
|
||||
'show_dashboard': is_backend_dashboard_available(course_key),
|
||||
}
|
||||
return section_data
|
||||
|
||||
|
||||
@@ -14,9 +14,11 @@ import pytz
|
||||
<h3 class="hd hd-3">${_('Student Special Exam Attempts')}</h3>
|
||||
<div class="student-proctored-exam-container" data-course-id="${ section_data['course_id'] }"></div>
|
||||
</div>
|
||||
% if section_data['show_dashboard']:
|
||||
<div class="wrap">
|
||||
<h3 class="hd hd-3">${_('Review Dashboard')}</h3>
|
||||
<div class="student-review-dashboard-container" data-course-id="${ section_data['course_id'] }"></div>
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -124,7 +124,7 @@ edx-milestones==0.1.13
|
||||
edx-oauth2-provider==1.2.2
|
||||
edx-opaque-keys[django]==0.4.4
|
||||
edx-organizations==1.0.0
|
||||
edx-proctoring==1.5.1
|
||||
edx-proctoring==1.5.2
|
||||
edx-rest-api-client==1.9.2
|
||||
edx-search==1.2.1
|
||||
edx-submissions==2.0.12
|
||||
|
||||
@@ -143,7 +143,7 @@ edx-milestones==0.1.13
|
||||
edx-oauth2-provider==1.2.2
|
||||
edx-opaque-keys[django]==0.4.4
|
||||
edx-organizations==1.0.0
|
||||
edx-proctoring==1.5.1
|
||||
edx-proctoring==1.5.2
|
||||
edx-rest-api-client==1.9.2
|
||||
edx-search==1.2.1
|
||||
edx-sphinx-theme==1.4.0
|
||||
|
||||
@@ -138,7 +138,7 @@ edx-milestones==0.1.13
|
||||
edx-oauth2-provider==1.2.2
|
||||
edx-opaque-keys[django]==0.4.4
|
||||
edx-organizations==1.0.0
|
||||
edx-proctoring==1.5.1
|
||||
edx-proctoring==1.5.2
|
||||
edx-rest-api-client==1.9.2
|
||||
edx-search==1.2.1
|
||||
edx-submissions==2.0.12
|
||||
|
||||
Reference in New Issue
Block a user