Commit ebe66950 by Chris Dodge

decling proctoring will not show the views

parent 66b468e7
......@@ -633,8 +633,13 @@ def get_student_view(user_id, course_id, content_id,
return None
attempt = get_exam_attempt(exam_id, user_id)
has_started_exam = attempt and attempt.get('started_at')
# if user has declined the attempt, then we don't show the
# proctored exam
if attempt and attempt['status'] == ProctoredExamStudentAttemptStatus.declined:
return None
has_started_exam = attempt and attempt.get('started_at')
if has_started_exam:
if attempt.get('status') == 'error':
student_view_template = 'proctoring/seq_proctored_exam_error.html'
......
......@@ -788,6 +788,26 @@ class ProctoredExamApiTests(LoggedInTestCase):
)
self.assertIn(self.chose_proctored_exam_msg % self.exam_name, rendered_response)
def test_declined_attempt(self):
"""
Make sure that a declined attempt does not show proctoring
"""
attempt_obj = self._create_unstarted_exam_attempt()
attempt_obj.status = ProctoredExamStudentAttemptStatus.declined
attempt_obj.save()
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
}
)
self.assertIsNone(rendered_response)
def test_get_studentview_started_exam(self): # pylint: disable=invalid-name
"""
Test for get_student_view proctored exam which has started.
......
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