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
6b1f5801
Commit
6b1f5801
authored
Aug 21, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test cases for the paginated exam attempts and assert num of queries
parent
5157b6da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
edx_proctoring/tests/test_models.py
+24
-0
edx_proctoring/tests/test_views.py
+37
-0
No files found.
edx_proctoring/tests/test_models.py
View file @
6b1f5801
...
@@ -142,3 +142,27 @@ class ProctoredExamStudentAttemptTests(LoggedInTestCase):
...
@@ -142,3 +142,27 @@ class ProctoredExamStudentAttemptTests(LoggedInTestCase):
attempt_history
=
ProctoredExamStudentAttemptHistory
.
objects
.
filter
(
user_id
=
1
)
attempt_history
=
ProctoredExamStudentAttemptHistory
.
objects
.
filter
(
user_id
=
1
)
self
.
assertEqual
(
len
(
attempt_history
),
1
)
self
.
assertEqual
(
len
(
attempt_history
),
1
)
def
test_get_exam_attempts
(
self
):
"""
Test to get all the exam attempts for a course
"""
# Create an exam.
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
)
# create number of exam attempts
for
i
in
range
(
90
):
ProctoredExamStudentAttempt
.
create_exam_attempt
(
proctored_exam
.
id
,
i
,
'test_name{0}'
.
format
(
i
),
i
+
1
,
'test_attempt_code{0}'
.
format
(
i
),
True
,
False
,
'test_external_id{0}'
.
format
(
i
)
)
with
self
.
assertNumQueries
(
1
):
exam_attempts
=
ProctoredExamStudentAttempt
.
objects
.
get_all_exam_attempts
(
'a/b/c'
)
self
.
assertEqual
(
len
(
exam_attempts
),
90
)
edx_proctoring/tests/test_views.py
View file @
6b1f5801
...
@@ -900,6 +900,43 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
...
@@ -900,6 +900,43 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
self
.
assertEqual
(
attempt
[
'proctored_exam'
][
'id'
],
proctored_exam
.
id
)
self
.
assertEqual
(
attempt
[
'proctored_exam'
][
'id'
],
proctored_exam
.
id
)
self
.
assertEqual
(
attempt
[
'user'
][
'id'
],
self
.
user
.
id
)
self
.
assertEqual
(
attempt
[
'user'
][
'id'
],
self
.
user
.
id
)
def
test_paginated_exam_attempts
(
self
):
"""
Test to get the paginated exam attempts in a course.
"""
# Create an exam.
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
)
# create number of exam attempts
for
i
in
range
(
90
):
ProctoredExamStudentAttempt
.
create_exam_attempt
(
proctored_exam
.
id
,
i
,
'test_name{0}'
.
format
(
i
),
i
+
1
,
'test_attempt_code{0}'
.
format
(
i
),
True
,
False
,
'test_external_id{0}'
.
format
(
i
)
)
self
.
client
.
login_user
(
self
.
user
)
response
=
self
.
client
.
get
(
reverse
(
'edx_proctoring.proctored_exam.attempts.course'
,
kwargs
=
{
'course_id'
:
proctored_exam
.
course_id
}
)
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_data
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
len
(
response_data
[
'proctored_exam_attempts'
]),
25
)
self
.
assertTrue
(
response_data
[
'pagination_info'
][
'has_next'
])
self
.
assertEqual
(
response_data
[
'pagination_info'
][
'total_pages'
],
4
)
self
.
assertEqual
(
response_data
[
'pagination_info'
][
'current_page'
],
1
)
def
test_stop_others_attempt
(
self
):
def
test_stop_others_attempt
(
self
):
"""
"""
Start an exam (create an exam attempt)
Start an exam (create an exam attempt)
...
...
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