Commit 5c681c58 by Chris Dodge

Course staff should not see any proctored exam stuff

parent 7b8492d7
# pylint: disable=unused-argument # pylint: disable=too-many-branches
# remove pylint rule after we implement each method
""" """
In-Proc API (aka Library) for the edx_proctoring subsystem. This is not to be confused with a HTTP REST In-Proc API (aka Library) for the edx_proctoring subsystem. This is not to be confused with a HTTP REST
...@@ -473,7 +471,8 @@ def get_active_exams_for_user(user_id, course_id=None): ...@@ -473,7 +471,8 @@ def get_active_exams_for_user(user_id, course_id=None):
return result return result
def get_student_view(user_id, course_id, content_id, context): # pylint: disable=too-many-branches def get_student_view(user_id, course_id, content_id,
context, user_role='student'):
""" """
Helper method that will return the view HTML related to the exam control Helper method that will return the view HTML related to the exam control
flow (i.e. entering, expired, completed, etc.) If there is no specific flow (i.e. entering, expired, completed, etc.) If there is no specific
...@@ -481,6 +480,11 @@ def get_student_view(user_id, course_id, content_id, context): # pylint: disabl ...@@ -481,6 +480,11 @@ def get_student_view(user_id, course_id, content_id, context): # pylint: disabl
render it's own view render it's own view
""" """
# non-student roles should never see any proctoring related
# screens
if user_role != 'student':
return None
has_finished_exam = False has_finished_exam = False
student_view_template = None student_view_template = None
......
...@@ -492,6 +492,25 @@ class ProctoredExamApiTests(LoggedInTestCase): ...@@ -492,6 +492,25 @@ class ProctoredExamApiTests(LoggedInTestCase):
self.assertIn('data-exam-id="%d"' % self.proctored_exam_id, rendered_response) self.assertIn('data-exam-id="%d"' % self.proctored_exam_id, rendered_response)
self.assertIn(self.start_an_exam_msg % self.exam_name, rendered_response) self.assertIn(self.start_an_exam_msg % self.exam_name, rendered_response)
def test_student_view_non_student(self):
"""
Make sure that if we ask for a student view if we are not in a student role,
then we don't see any proctoring views
"""
rendered_response = get_student_view(
user_id=self.user_id,
course_id=self.course_id,
content_id=self.content_id,
context={
'is_proctored': True,
'display_name': self.exam_name,
'default_time_limit_mins': 90
},
user_role='staff'
)
self.assertIsNone(rendered_response)
def test_get_disabled_student_view(self): def test_get_disabled_student_view(self):
""" """
Assert that a disabled proctored exam will not override the Assert that a disabled proctored exam will not override the
......
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