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
bd19cd65
Commit
bd19cd65
authored
Sep 07, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SOL-1168 added the check and the test case
parent
82b6ddb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletions
+40
-1
edx_proctoring/api.py
+15
-0
edx_proctoring/tests/test_api.py
+25
-1
No files found.
edx_proctoring/api.py
View file @
bd19cd65
...
@@ -950,12 +950,23 @@ PRACTICE_STATUS_SUMMARY_MAP = {
...
@@ -950,12 +950,23 @@ PRACTICE_STATUS_SUMMARY_MAP = {
}
}
}
}
TIMED_EXAM_STATUS_SUMMARY_MAP
=
{
'_default'
:
{
'short_description'
:
_
(
'Timed Exam'
),
'suggested_icon'
:
'fa-clock-o'
,
'in_completed_state'
:
False
}
}
def
get_attempt_status_summary
(
user_id
,
course_id
,
content_id
):
def
get_attempt_status_summary
(
user_id
,
course_id
,
content_id
):
"""
"""
Returns a summary about the status of the attempt for the user
Returns a summary about the status of the attempt for the user
in the course_id and content_id
in the course_id and content_id
If the exam is timed exam only then we simply
return the dictionary with timed exam default summary
Return will be:
Return will be:
None: Not applicable
None: Not applicable
- or -
- or -
...
@@ -974,6 +985,10 @@ def get_attempt_status_summary(user_id, course_id, content_id):
...
@@ -974,6 +985,10 @@ def get_attempt_status_summary(user_id, course_id, content_id):
log
.
exception
(
ex
)
log
.
exception
(
ex
)
return
None
return
None
# check if the exam is not proctored
if
not
exam
[
'is_proctored'
]:
return
TIMED_EXAM_STATUS_SUMMARY_MAP
[
'_default'
]
# let's check credit eligibility
# let's check credit eligibility
credit_service
=
get_runtime_service
(
'credit'
)
credit_service
=
get_runtime_service
(
'credit'
)
# practice exams always has an attempt status regardless of
# practice exams always has an attempt status regardless of
...
...
edx_proctoring/tests/test_api.py
View file @
bd19cd65
...
@@ -148,7 +148,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -148,7 +148,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
exam_name
=
self
.
exam_name
,
exam_name
=
self
.
exam_name
,
time_limit_mins
=
self
.
default_time_limit
,
time_limit_mins
=
self
.
default_time_limit
,
is_practice_exam
=
True
,
is_practice_exam
=
True
,
is_proctored
=
Fals
e
is_proctored
=
Tru
e
)
)
def
_create_disabled_exam
(
self
):
def
_create_disabled_exam
(
self
):
...
@@ -1462,6 +1462,30 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -1462,6 +1462,30 @@ class ProctoredExamApiTests(LoggedInTestCase):
@ddt.data
(
@ddt.data
(
(
(
{
'short_description'
:
'Timed Exam'
,
'suggested_icon'
:
'fa-clock-o'
,
'in_completed_state'
:
False
},
)
)
@ddt.unpack
def
test_timed_exam_status_summary
(
self
,
expected
):
"""
Assert that we get the expected status summaries
for the timed exams.
"""
timed_exam
=
get_exam_by_id
(
self
.
timed_exam
)
summary
=
get_attempt_status_summary
(
self
.
user
.
id
,
timed_exam
[
'course_id'
],
timed_exam
[
'content_id'
]
)
self
.
assertIn
(
summary
,
[
expected
])
@ddt.data
(
(
ProctoredExamStudentAttemptStatus
.
eligible
,
{
ProctoredExamStudentAttemptStatus
.
eligible
,
{
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'short_description'
:
'Ungraded Practice Exam'
,
'short_description'
:
'Ungraded Practice Exam'
,
...
...
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