diff --git a/edx_exams/apps/api/v1/views.py b/edx_exams/apps/api/v1/views.py index 59c1fdbc..5b10979f 100644 --- a/edx_exams/apps/api/v1/views.py +++ b/edx_exams/apps/api/v1/views.py @@ -26,7 +26,6 @@ from edx_exams.apps.core.api import ( check_if_exam_timed_out, create_exam_attempt, - delete_exam_attempt, get_active_attempt_for_user, get_attempt_by_id, get_course_exams, @@ -37,6 +36,7 @@ get_exam_by_id, get_provider_by_exam_id, is_exam_passed_due, + reset_exam_attempt, update_attempt_status ) from edx_exams.apps.core.exam_types import get_exam_type @@ -627,7 +627,7 @@ def delete(self, request, attempt_id): error = {'detail': error_msg} return Response(status=status.HTTP_403_FORBIDDEN, data=error) - delete_exam_attempt(exam_attempt, request.user) + reset_exam_attempt(exam_attempt, request.user) return Response(status=status.HTTP_204_NO_CONTENT) diff --git a/edx_exams/apps/core/api.py b/edx_exams/apps/core/api.py index b0b10a86..84a66155 100644 --- a/edx_exams/apps/core/api.py +++ b/edx_exams/apps/core/api.py @@ -143,9 +143,9 @@ def update_attempt_status(attempt_id, to_status): return attempt_id -def delete_exam_attempt(attempt, requesting_user): +def reset_exam_attempt(attempt, requesting_user): """ - Delete or 'reset' an exam attempt + Reset an exam attempt """ course_key = CourseKey.from_string(attempt.exam.course_id) usage_key = UsageKey.from_string(attempt.exam.content_id) diff --git a/edx_exams/apps/core/tests/test_api.py b/edx_exams/apps/core/tests/test_api.py index 0c5a4f85..d5155fd2 100644 --- a/edx_exams/apps/core/tests/test_api.py +++ b/edx_exams/apps/core/tests/test_api.py @@ -17,7 +17,6 @@ from edx_exams.apps.core.api import ( check_if_exam_timed_out, create_exam_attempt, - delete_exam_attempt, get_active_attempt_for_user, get_attempt_by_id, get_attempt_for_user_with_attempt_number_and_resource_id, @@ -26,6 +25,7 @@ get_exam_by_content_id, get_exam_url_path, is_exam_passed_due, + reset_exam_attempt, update_attempt_status ) from edx_exams.apps.core.exceptions import ( @@ -624,9 +624,9 @@ def test_exam_with_no_due_date(self): self.assertIsNotNone(ExamAttempt.objects.get(user_id=user_id, exam_id=exam_id)) -class TestDeleteExamAttempt(ExamsAPITestCase): +class TestResetExamAttempt(ExamsAPITestCase): """ - Tests for the API utility function `delete_exam_attempt` + Tests for the API utility function `reset_exam_attempt` """ def setUp(self): super().setUp() @@ -635,7 +635,7 @@ def setUp(self): self.student_user = UserFactory() self.exam_attempt = ExamAttemptFactory(user=self.student_user, exam=self.exam) - def test_delete_exam_attempt(self): + def test_reset_exam_attempt(self): """ Test that an exam attempt is deleted """ @@ -645,7 +645,7 @@ def test_delete_exam_attempt(self): @patch('edx_exams.apps.core.signals.signals.EXAM_ATTEMPT_RESET.send_event') def test_event_emitted(self, mock_event_send): """ - Test that when an exam attempt is deleted, the EXAM_ATTEMPT_RESET event is emitted. + Test that when an exam attempt is reset, the EXAM_ATTEMPT_RESET event is emitted. """ delete_exam_attempt(self.exam_attempt, self.user)