Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-proctoring
Commits
eaf8a896
Commit
eaf8a896
authored
Mar 10, 2016
by
Eric Fischer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #281 from edx/efischer/delete_state
Pass requesting user on delete_student_attempt
parents
a7dc8756
5e00da60
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
12 deletions
+25
-12
edx_proctoring/api.py
+3
-3
edx_proctoring/backends/tests/test_software_secure.py
+2
-2
edx_proctoring/tests/test_api.py
+12
-4
edx_proctoring/tests/test_services.py
+6
-1
edx_proctoring/views.py
+1
-1
setup.py
+1
-1
No files found.
edx_proctoring/api.py
View file @
eaf8a896
...
...
@@ -962,9 +962,9 @@ def send_proctoring_attempt_status_email(exam_attempt_obj, course_name):
email
.
send
()
def
remove_exam_attempt
(
attempt_id
):
def
remove_exam_attempt
(
attempt_id
,
requesting_user
):
"""
Removes an exam attempt given the attempt id.
Removes an exam attempt given the attempt id.
requesting_user is passed through to the instructor_service.
"""
log_msg
=
(
...
...
@@ -991,7 +991,7 @@ def remove_exam_attempt(attempt_id):
instructor_service
=
get_runtime_service
(
'instructor'
)
if
instructor_service
:
instructor_service
.
delete_student_attempt
(
username
,
course_id
,
content_id
)
instructor_service
.
delete_student_attempt
(
username
,
course_id
,
content_id
,
requesting_user
=
requesting_user
)
# see if the status transition this changes credit requirement status
if
ProctoredExamStudentAttemptStatus
.
needs_credit_status_update
(
to_status
):
...
...
edx_proctoring/backends/tests/test_software_secure.py
View file @
eaf8a896
...
...
@@ -649,7 +649,7 @@ class SoftwareSecureTests(TestCase):
)
# now delete the attempt, which puts it into the archive table
remove_exam_attempt
(
attempt_id
)
remove_exam_attempt
(
attempt_id
,
requesting_user
=
self
.
user
)
# now process the report
provider
.
on_review_callback
(
json
.
loads
(
test_payload
))
...
...
@@ -873,7 +873,7 @@ class SoftwareSecureTests(TestCase):
self
.
assertEqual
(
attempt
[
'status'
],
attempt
[
'status'
])
# now delete the attempt, which puts it into the archive table
remove_exam_attempt
(
attempt_id
)
remove_exam_attempt
(
attempt_id
,
requesting_user
=
self
.
user
)
review
=
ProctoredExamSoftwareSecureReview
.
objects
.
get
(
attempt_code
=
attempt
[
'attempt_code'
])
...
...
edx_proctoring/tests/test_api.py
View file @
eaf8a896
...
...
@@ -827,13 +827,21 @@ class ProctoredExamApiTests(LoggedInTestCase):
Calling the api remove function removes the attempt.
"""
with
self
.
assertRaises
(
StudentExamAttemptDoesNotExistsException
):
remove_exam_attempt
(
9999
)
remove_exam_attempt
(
9999
,
requesting_user
=
self
.
user
)
proctored_exam_student_attempt
=
self
.
_create_unstarted_exam_attempt
()
remove_exam_attempt
(
proctored_exam_student_attempt
.
id
)
remove_exam_attempt
(
proctored_exam_student_attempt
.
id
,
requesting_user
=
self
.
user
)
with
self
.
assertRaises
(
StudentExamAttemptDoesNotExistsException
):
remove_exam_attempt
(
proctored_exam_student_attempt
.
id
)
remove_exam_attempt
(
proctored_exam_student_attempt
.
id
,
requesting_user
=
self
.
user
)
def
test_remove_no_user
(
self
):
"""
Attempting to remove an exam attempt without providing a requesting user will fail.
"""
proctored_exam_student_attempt
=
self
.
_create_unstarted_exam_attempt
()
with
self
.
assertRaises
(
UserNotFoundException
):
remove_exam_attempt
(
proctored_exam_student_attempt
.
id
,
requesting_user
=
{})
@ddt.data
(
(
ProctoredExamStudentAttemptStatus
.
verified
,
'satisfied'
),
...
...
@@ -868,7 +876,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
)
# now remove exam attempt which calls the credit service method 'remove_credit_requirement_status'
remove_exam_attempt
(
exam_attempt
.
proctored_exam_id
)
remove_exam_attempt
(
exam_attempt
.
proctored_exam_id
,
requesting_user
=
self
.
user
)
# make sure the credit requirement status is no longer there
credit_status
=
credit_service
.
get_credit_state
(
self
.
user
.
id
,
exam_attempt
.
proctored_exam
.
course_id
)
...
...
edx_proctoring/tests/test_services.py
View file @
eaf8a896
...
...
@@ -10,6 +10,7 @@ from datetime import datetime, timedelta
from
edx_proctoring.services
import
(
ProctoringService
)
from
edx_proctoring.exceptions
import
UserNotFoundException
from
edx_proctoring
import
api
as
edx_proctoring_api
import
types
...
...
@@ -111,10 +112,14 @@ class MockInstructorService(object):
"""
self
.
is_user_course_staff
=
is_user_course_staff
def
delete_student_attempt
(
self
,
student_identifier
,
course_id
,
content_id
):
# pylint: disable=unused-argument
# pylint: disable=unused-argument
def
delete_student_attempt
(
self
,
student_identifier
,
course_id
,
content_id
,
requesting_user
):
"""
Mock implementation
"""
# Ensure that this method was called with a real user object
if
not
hasattr
(
requesting_user
,
'id'
):
raise
UserNotFoundException
return
True
def
is_course_staff
(
self
,
user
,
course_id
):
...
...
edx_proctoring/views.py
View file @
eaf8a896
...
...
@@ -464,7 +464,7 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView):
)
raise
StudentExamAttemptDoesNotExistsException
(
err_msg
)
remove_exam_attempt
(
attempt_id
)
remove_exam_attempt
(
attempt_id
,
request
.
user
)
return
Response
()
except
ProctoredBaseException
,
ex
:
...
...
setup.py
View file @
eaf8a896
...
...
@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup
(
name
=
'edx-proctoring'
,
version
=
'0.12.1
3
'
,
version
=
'0.12.1
4
'
,
description
=
'Proctoring subsystem for Open edX'
,
long_description
=
open
(
'README.md'
)
.
read
(),
author
=
'edX'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment