@@ -264,7 +264,9 @@ def test_attempt_exam_type(self, is_proctored, is_practice_exam, expected_type):
264264 data = response .json ()
265265 assert data ['count' ] == 1
266266 assert data ['results' ][0 ]['exam_id' ] == exam_id
267+ assert data ['results' ][0 ]['exam_name' ] == 'Test Exam'
267268 assert data ['results' ][0 ]['exam_type' ] == expected_type
269+ assert data ['results' ][0 ]['ready_to_resume' ] is False
268270 assert data ['results' ][0 ]['user' ]['username' ] == 'student1'
269271
270272 def test_list_attempts_filters_by_exam (self ):
@@ -280,6 +282,18 @@ def test_list_attempts_filters_by_exam(self):
280282 assert data ['count' ] == 1
281283 assert data ['results' ][0 ]['exam_id' ] == exam_id
282284
285+ def test_ready_to_resume_true (self ):
286+ """Verify ready_to_resume reflects the actual attempt state."""
287+ exam_id = self ._create_exam ()
288+ attempt_id = create_exam_attempt (exam_id , self .student .id )
289+ attempt = ProctoredExamStudentAttempt .objects .get (id = attempt_id )
290+ attempt .ready_to_resume = True
291+ attempt .save ()
292+
293+ response = self .client .get (self ._url (exam_id ))
294+ assert response .status_code == status .HTTP_200_OK
295+ assert response .json ()['results' ][0 ]['ready_to_resume' ] is True
296+
283297
284298@override_settings (** PROCTORING_SETTINGS )
285299@patch .dict (settings .FEATURES , {'ENABLE_SPECIAL_EXAMS' : True })
@@ -682,6 +696,8 @@ def test_list_all_attempts(self):
682696 data = response .json ()
683697 assert data ['count' ] == 1
684698 assert data ['results' ][0 ]['exam_id' ] == self .exam_id
699+ assert data ['results' ][0 ]['exam_name' ] == 'Midterm Exam'
700+ assert data ['results' ][0 ]['ready_to_resume' ] is False
685701
686702 def test_search_attempts_by_username (self ):
687703 create_exam_attempt (self .exam_id , self .student .id )
@@ -750,3 +766,14 @@ def test_sort_attempts_descending(self):
750766 results = response .json ()['results' ]
751767 assert results [0 ]['user' ]['username' ] == 'student2'
752768 assert results [1 ]['user' ]['username' ] == 'student1'
769+
770+ def test_ready_to_resume_true (self ):
771+ """Verify ready_to_resume reflects the actual attempt state."""
772+ attempt_id = create_exam_attempt (self .exam_id , self .student .id )
773+ attempt = ProctoredExamStudentAttempt .objects .get (id = attempt_id )
774+ attempt .ready_to_resume = True
775+ attempt .save ()
776+
777+ response = self .client .get (self ._url ())
778+ assert response .status_code == status .HTTP_200_OK
779+ assert response .json ()['results' ][0 ]['ready_to_resume' ] is True
0 commit comments