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
OpenEdx
edx-proctoring
Commits
e0628954
Commit
e0628954
authored
Aug 06, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix when there is no attempt
parent
19240462
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
edx_proctoring/api.py
+1
-1
edx_proctoring/tests/test_api.py
+32
-4
No files found.
edx_proctoring/api.py
View file @
e0628954
...
...
@@ -848,7 +848,7 @@ def get_attempt_status_summary(user_id, course_id, content_id):
attempt
=
get_exam_attempt
(
exam
[
'id'
],
user_id
)
status
=
attempt
[
'status'
]
if
attempt
else
ProctoredExamStudentAttemptStatus
.
eligible
status_map
=
STATUS_SUMMARY_MAP
if
not
attempt
[
'is_sample_attempt
'
]
else
PRACTICE_STATUS_SUMMARY_MAP
status_map
=
STATUS_SUMMARY_MAP
if
not
exam
[
'is_practice_exam
'
]
else
PRACTICE_STATUS_SUMMARY_MAP
summary
=
None
if
status
in
status_map
:
...
...
edx_proctoring/tests/test_api.py
View file @
e0628954
...
...
@@ -1317,7 +1317,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
Assert that we get the expected status summaries
"""
exam_attempt
=
self
.
_create_started_
exam_attempt
(
is_sample_attempt
=
True
)
exam_attempt
=
self
.
_create_started_
practice_exam_attempt
(
)
update_attempt_status
(
exam_attempt
.
proctored_exam_id
,
self
.
user
.
id
,
...
...
@@ -1366,9 +1366,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
set_runtime_service
(
'credit'
,
MockCreditService
(
enrollment_mode
=
'honor'
))
exam_attempt
=
self
.
_create_started_exam_attempt
(
is_sample_attempt
=
True
)
exam_attempt
.
proctored_exam
.
is_practice_exam
=
True
exam_attempt
.
proctored_exam
.
save
()
exam_attempt
=
self
.
_create_started_practice_exam_attempt
()
update_attempt_status
(
exam_attempt
.
proctored_exam_id
,
...
...
@@ -1384,6 +1382,36 @@ class ProctoredExamApiTests(LoggedInTestCase):
self
.
assertIn
(
summary
,
[
expected
])
def
test_practice_no_attempt
(
self
):
"""
Assert that we get the expected status summaries
"""
expected
=
{
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'short_description'
:
'Ungraded Practice Exam'
,
'suggested_icon'
:
'fa-lock'
,
'in_completed_state'
:
False
}
exam
=
get_exam_by_id
(
self
.
practice_exam_id
)
set_runtime_service
(
'credit'
,
MockCreditService
(
enrollment_mode
=
'honor'
))
summary
=
get_attempt_status_summary
(
self
.
user
.
id
,
exam
[
'course_id'
],
exam
[
'content_id'
]
)
self
.
assertIn
(
summary
,
[
expected
])
set_runtime_service
(
'credit'
,
MockCreditService
())
summary
=
get_attempt_status_summary
(
self
.
user
.
id
,
exam
[
'course_id'
],
exam
[
'content_id'
]
)
self
.
assertIn
(
summary
,
[
expected
])
@ddt.data
(
'honor'
,
'staff'
)
...
...
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