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
a9a7ae06
Commit
a9a7ae06
authored
Feb 09, 2016
by
Ibrahim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the bug where the learner gets full time even after due date is passed
parent
f2cc8597
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
edx_proctoring/tests/test_views.py
+27
-0
edx_proctoring/views.py
+4
-2
No files found.
edx_proctoring/tests/test_views.py
View file @
a9a7ae06
...
...
@@ -905,6 +905,33 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
response_data
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
response_data
[
'status'
],
'submitted'
)
def
test_attempt_with_duedate_expired
(
self
):
"""
Tests that an exam with duedate passed cannot be accessed
"""
# create an exam with duedate passed
proctored_exam
=
ProctoredExam
.
objects
.
create
(
course_id
=
'a/b/c'
,
content_id
=
'test_content'
,
exam_name
=
'Test Exam'
,
external_id
=
'123aXqe3'
,
time_limit_mins
=
90
,
due_date
=
datetime
.
now
(
pytz
.
UTC
)
-
timedelta
(
minutes
=
10
),
)
attempt_data
=
{
'exam_id'
:
proctored_exam
.
id
,
'external_id'
:
proctored_exam
.
external_id
,
'start_clock'
:
True
,
}
# Starting exam attempt
response
=
self
.
client
.
post
(
reverse
(
'edx_proctoring.proctored_exam.attempt.collection'
),
attempt_data
)
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertRaises
(
ProctoredExamPermissionDenied
)
def
test_remove_attempt
(
self
):
"""
Confirms that an attempt can be removed
...
...
edx_proctoring/views.py
View file @
a9a7ae06
...
...
@@ -595,14 +595,16 @@ class StudentProctoredExamAttemptCollection(AuthenticatedAPIView):
exam_id
=
request
.
data
.
get
(
'exam_id'
,
None
)
attempt_proctored
=
request
.
data
.
get
(
'attempt_proctored'
,
'false'
)
.
lower
()
==
'true'
try
:
exam
=
get_exam_by_id
(
exam_id
)
if
exam
[
'due_date'
]
and
exam
[
'due_date'
]
<=
datetime
.
now
(
pytz
.
UTC
):
raise
ProctoredExamPermissionDenied
(
'Attempted to access expired exam'
)
exam_attempt_id
=
create_exam_attempt
(
exam_id
=
exam_id
,
user_id
=
request
.
user
.
id
,
taking_as_proctored
=
attempt_proctored
)
exam
=
get_exam_by_id
(
exam_id
)
# if use elected not to take as proctored exam, then
# use must take as open book, and loose credit eligibility
if
exam
[
'is_proctored'
]
and
not
attempt_proctored
:
...
...
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