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
e3de2426
Commit
e3de2426
authored
Dec 08, 2015
by
Hasnain Naveed
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #240 from edx/hasnain-naveed/PHX-189
PHX-189 / adding practice exam option in context
parents
67516498
cb5bc624
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletions
+41
-1
edx_proctoring/tests/test_views.py
+37
-0
edx_proctoring/views.py
+4
-1
No files found.
edx_proctoring/tests/test_views.py
View file @
e3de2426
...
@@ -1877,6 +1877,43 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
...
@@ -1877,6 +1877,43 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
@ddt.data
(
(
True
,
True
,
'practice'
),
(
True
,
False
,
'proctored'
),
(
False
,
False
,
'timed'
)
)
@ddt.unpack
def
test_exam_type
(
self
,
is_proctored
,
is_practice
,
expected_exam_type
):
"""
Testing the exam type
"""
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
,
is_proctored
=
is_proctored
,
is_practice_exam
=
is_practice
)
ProctoredExamStudentAttempt
.
objects
.
create
(
proctored_exam
=
proctored_exam
,
user
=
self
.
user
,
allowed_time_limit_mins
=
90
,
taking_as_proctored
=
is_proctored
,
is_sample_attempt
=
is_practice
,
external_id
=
proctored_exam
.
external_id
,
status
=
ProctoredExamStudentAttemptStatus
.
started
)
response
=
self
.
client
.
get
(
reverse
(
'edx_proctoring.proctored_exam.attempt.collection'
)
)
self
.
assertEqual
(
response
.
status_code
,
200
)
data
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
data
[
'exam_type'
],
expected_exam_type
)
class
TestExamAllowanceView
(
LoggedInTestCase
):
class
TestExamAllowanceView
(
LoggedInTestCase
):
"""
"""
...
...
edx_proctoring/views.py
View file @
e3de2426
...
@@ -559,7 +559,10 @@ class StudentProctoredExamAttemptCollection(AuthenticatedAPIView):
...
@@ -559,7 +559,10 @@ class StudentProctoredExamAttemptCollection(AuthenticatedAPIView):
response_dict
=
{
response_dict
=
{
'in_timed_exam'
:
True
,
'in_timed_exam'
:
True
,
'taking_as_proctored'
:
attempt
[
'taking_as_proctored'
],
'taking_as_proctored'
:
attempt
[
'taking_as_proctored'
],
'exam_type'
:
_
(
'proctored'
)
if
attempt
[
'taking_as_proctored'
]
else
_
(
'timed'
),
'exam_type'
:
(
_
(
'timed'
)
if
not
attempt
[
'taking_as_proctored'
]
else
(
_
(
'practice'
)
if
attempt
[
'is_sample_attempt'
]
else
_
(
'proctored'
))
),
'exam_display_name'
:
exam
[
'exam_name'
],
'exam_display_name'
:
exam
[
'exam_name'
],
'exam_url_path'
:
exam_url_path
,
'exam_url_path'
:
exam_url_path
,
'time_remaining_seconds'
:
time_remaining_seconds
,
'time_remaining_seconds'
:
time_remaining_seconds
,
...
...
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