Commit 3504e79f by attiyaishaque

EDUCATOR-1104 Fix 500 error in course page.

parent 2bee1437
...@@ -1235,7 +1235,7 @@ def _check_eligibility_of_enrollment_mode(credit_state): ...@@ -1235,7 +1235,7 @@ def _check_eligibility_of_enrollment_mode(credit_state):
# Also make an exception for the honor students to take the "practice exam" as a proctored exam. # Also make an exception for the honor students to take the "practice exam" as a proctored exam.
# For the rest of the enrollment modes, None is returned which shows the exam content # For the rest of the enrollment modes, None is returned which shows the exam content
# to the student rather than the proctoring prompt. # to the student rather than the proctoring prompt.
return credit_state['enrollment_mode'] == 'verified' return credit_state and credit_state['enrollment_mode'] == 'verified'
def _get_ordered_prerequisites(prerequisites_statuses, filter_out_namespaces=None): def _get_ordered_prerequisites(prerequisites_statuses, filter_out_namespaces=None):
......
...@@ -1648,3 +1648,18 @@ class ProctoredExamApiTests(ProctoredExamTestCase): ...@@ -1648,3 +1648,18 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
self.assertEqual(len(results['failed_prerequisites']), expected_len_failed_prerequisites) self.assertEqual(len(results['failed_prerequisites']), expected_len_failed_prerequisites)
self.assertEqual(len(results['pending_prerequisites']), expected_len_pending_prerequisites) self.assertEqual(len(results['pending_prerequisites']), expected_len_pending_prerequisites)
self.assertEqual(len(results['declined_prerequisites']), expected_len_declined_prerequisites) self.assertEqual(len(results['declined_prerequisites']), expected_len_declined_prerequisites)
def test_summary_without_credit_state(self):
"""
Test that attempt status summary is None for users who are not enrolled.
"""
exam_id = self._create_exam_with_due_time()
set_runtime_service('credit', MockCreditServiceNone())
timed_exam = get_exam_by_id(exam_id)
summary = get_attempt_status_summary(
self.user.id,
timed_exam['course_id'],
timed_exam['content_id']
)
self.assertIsNone(summary)
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