Skip to content

Commit

Permalink
style: better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharis278 committed Oct 5, 2023
1 parent fada7f9 commit 00891d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions edx_exams/apps/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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)


Expand Down
4 changes: 2 additions & 2 deletions edx_exams/apps/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions edx_exams/apps/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 (
Expand Down Expand Up @@ -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()
Expand All @@ -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
"""
Expand All @@ -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)

Expand Down

0 comments on commit 00891d6

Please sign in to comment.