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
ff31afa0
Commit
ff31afa0
authored
Jul 09, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the test cases and css for the modal pop up.
parent
f040c95f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
115 additions
and
5 deletions
+115
-5
edx_proctoring/static/proctoring/js/views/Backbone.ModalDialog.js
+33
-4
edx_proctoring/static/proctoring/templates/add-new-allowance.underscore
+1
-0
edx_proctoring/tests/test_api.py
+21
-1
edx_proctoring/tests/test_views.py
+60
-0
No files found.
edx_proctoring/static/proctoring/js/views/Backbone.ModalDialog.js
View file @
ff31afa0
...
@@ -31,7 +31,7 @@ Backbone.ModalView =
...
@@ -31,7 +31,7 @@ Backbone.ModalView =
pressingEscapeClosesModal
:
true
,
pressingEscapeClosesModal
:
true
,
css
:
css
:
{
{
"border"
:
"
2
px solid #111"
,
"border"
:
"
1
px solid #111"
,
"display"
:
"block"
,
"display"
:
"block"
,
"background-color"
:
"#fff"
,
"background-color"
:
"#fff"
,
"-webkit-box-shadow"
:
"0px 0px 15px 4px rgba(0, 0, 0, 0.5)"
,
"-webkit-box-shadow"
:
"0px 0px 15px 4px rgba(0, 0, 0, 0.5)"
,
...
@@ -39,7 +39,8 @@ Backbone.ModalView =
...
@@ -39,7 +39,8 @@ Backbone.ModalView =
"box-shadow"
:
"0px 0px 15px 4px rgba(0, 0, 0, 0.5)"
,
"box-shadow"
:
"0px 0px 15px 4px rgba(0, 0, 0, 0.5)"
,
"-webkit-border-radius"
:
"10px"
,
"-webkit-border-radius"
:
"10px"
,
"-moz-border-radius"
:
"10px"
,
"-moz-border-radius"
:
"10px"
,
"border-radius"
:
"10px"
"border-radius"
:
"6px"
,
"padding"
:
"0px"
}
}
},
},
...
@@ -268,6 +269,34 @@ Backbone.ModalView =
...
@@ -268,6 +269,34 @@ Backbone.ModalView =
};
};
$el
.
css
(
this
.
options
.
css
);
$el
.
css
(
this
.
options
.
css
);
$el
.
find
(
'.modal-header'
).
css
({
"color"
:
"#1580b0"
,
"font-size"
:
"20px"
,
"font-weight"
:
"600"
,
"line-height"
:
"normal"
,
"padding"
:
"10px 15px"
,
"border-bottom"
:
"1px solid #ccc"
});
$el
.
find
(
'form'
).
css
({
"padding"
:
"15px"
});
$el
.
find
(
'form table.compact td'
).
css
({
"vertical-align"
:
"middle"
,
"padding"
:
"4px 8px"
});
$el
.
find
(
'form label'
).
css
({
"display"
:
"block"
,
"font-size"
:
"14px"
,
"margin"
:
0
});
$el
.
find
(
'form input[type="text"]'
).
css
({
"height"
:
"26px"
,
"padding"
:
"5px 8px"
});
$el
.
find
(
'form input[type="submit"]'
).
css
({
"margin-top"
:
"10px"
,
"padding"
:
"2px 32px"
});
this
.
showModalBlanket
();
this
.
showModalBlanket
();
this
.
keyup
=
_
.
bind
(
this
.
keyup
,
this
);
this
.
keyup
=
_
.
bind
(
this
.
keyup
,
this
);
...
@@ -342,8 +371,8 @@ Backbone.ModalView =
...
@@ -342,8 +371,8 @@ Backbone.ModalView =
$
(
"<a href='#' id='modalCloseButton'> </a>"
)
$
(
"<a href='#' id='modalCloseButton'> </a>"
)
.
css
({
.
css
({
"position"
:
"absolute"
,
"position"
:
"absolute"
,
"top"
:
"-8px"
,
"top"
:
"-8px"
,
"right"
:
"-513
px"
,
"right"
:
"-495
px"
,
"width"
:
"32px"
,
"width"
:
"32px"
,
"height"
:
"32px"
,
"height"
:
"32px"
,
"z-index"
:
"999999"
,
"z-index"
:
"999999"
,
...
...
edx_proctoring/static/proctoring/templates/add-new-allowance.underscore
View file @
ff31afa0
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>
<td>
<input id='addNewAllowance' type='submit' value='Save' />
<input id='addNewAllowance' type='submit' value='Save' />
</td>
</td>
...
...
edx_proctoring/tests/test_api.py
View file @
ff31afa0
...
@@ -16,7 +16,9 @@ from edx_proctoring.api import (
...
@@ -16,7 +16,9 @@ from edx_proctoring.api import (
get_exam_attempt
,
get_exam_attempt
,
create_exam_attempt
,
create_exam_attempt
,
get_student_view
,
get_student_view
,
get_all_exams_for_course
,
get_exams_by_course_id
,
get_allowances_for_course
,
get_all_exams_for_course
)
)
from
edx_proctoring.exceptions
import
(
from
edx_proctoring.exceptions
import
(
ProctoredExamAlreadyExists
,
ProctoredExamAlreadyExists
,
...
@@ -118,6 +120,15 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -118,6 +120,15 @@ class ProctoredExamApiTests(LoggedInTestCase):
proctored_exam_id
=
self
.
proctored_exam_id
,
user_id
=
self
.
user_id
,
key
=
self
.
key
,
value
=
self
.
value
proctored_exam_id
=
self
.
proctored_exam_id
,
user_id
=
self
.
user_id
,
key
=
self
.
key
,
value
=
self
.
value
)
)
def
test_get_exams_by_course_id
(
self
):
"""
Test to get the exams by course_id
"""
proctored_exams
=
get_exams_by_course_id
(
self
.
course_id
)
self
.
assertEqual
(
len
(
proctored_exams
),
1
)
self
.
assertEqual
(
proctored_exams
[
0
][
'exam_name'
],
self
.
exam_name
)
self
.
assertEqual
(
proctored_exams
[
0
][
'course_id'
],
self
.
course_id
)
def
test_create_duplicate_exam
(
self
):
def
test_create_duplicate_exam
(
self
):
"""
"""
Test to create a proctored exam that has already exist in the
Test to create a proctored exam that has already exist in the
...
@@ -208,6 +219,15 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -208,6 +219,15 @@ class ProctoredExamApiTests(LoggedInTestCase):
self
.
assertIsNotNone
(
student_allowance
)
self
.
assertIsNotNone
(
student_allowance
)
self
.
assertEqual
(
student_allowance
.
value
,
'new_value'
)
self
.
assertEqual
(
student_allowance
.
value
,
'new_value'
)
def
test_get_allowances_for_course
(
self
):
"""
Test to get all the allowances for a course.
"""
allowance
=
self
.
_add_allowance_for_user
()
course_allowances
=
get_allowances_for_course
(
self
.
course_id
)
self
.
assertEqual
(
len
(
course_allowances
),
1
)
self
.
assertEqual
(
course_allowances
[
0
][
'proctored_exam'
][
'course_id'
],
allowance
.
proctored_exam
.
course_id
)
def
test_get_non_existing_allowance
(
self
):
def
test_get_non_existing_allowance
(
self
):
"""
"""
Test to get an allowance which does not exist.
Test to get an allowance which does not exist.
...
...
edx_proctoring/tests/test_views.py
View file @
ff31afa0
...
@@ -276,6 +276,32 @@ class ProctoredExamViewTests(LoggedInTestCase):
...
@@ -276,6 +276,32 @@ class ProctoredExamViewTests(LoggedInTestCase):
self
.
assertEqual
(
response_data
[
'external_id'
],
proctored_exam
.
external_id
)
self
.
assertEqual
(
response_data
[
'external_id'
],
proctored_exam
.
external_id
)
self
.
assertEqual
(
response_data
[
'time_limit_mins'
],
proctored_exam
.
time_limit_mins
)
self
.
assertEqual
(
response_data
[
'time_limit_mins'
],
proctored_exam
.
time_limit_mins
)
def
test_get_exam_by_course_id
(
self
):
"""
Tests the Get Exam by course id endpoint
"""
# 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
)
response
=
self
.
client
.
get
(
reverse
(
'edx_proctoring.proctored_exam.exams_by_course_id'
,
kwargs
=
{
'course_id'
:
proctored_exam
.
course_id
})
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_data
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
response_data
[
0
][
'course_id'
],
proctored_exam
.
course_id
)
self
.
assertEqual
(
response_data
[
0
][
'exam_name'
],
proctored_exam
.
exam_name
)
self
.
assertEqual
(
response_data
[
0
][
'content_id'
],
proctored_exam
.
content_id
)
self
.
assertEqual
(
response_data
[
0
][
'external_id'
],
proctored_exam
.
external_id
)
self
.
assertEqual
(
response_data
[
0
][
'time_limit_mins'
],
proctored_exam
.
time_limit_mins
)
def
test_get_exam_by_bad_content_id
(
self
):
def
test_get_exam_by_bad_content_id
(
self
):
"""
"""
Tests the Get Exam by content id endpoint
Tests the Get Exam by content id endpoint
...
@@ -613,6 +639,40 @@ class TestExamAllowanceView(LoggedInTestCase):
...
@@ -613,6 +639,40 @@ class TestExamAllowanceView(LoggedInTestCase):
)
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_get_allowances_for_course
(
self
):
"""
Remove allowance for a user for an exam.
"""
# 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
)
allowance_data
=
{
'exam_id'
:
proctored_exam
.
id
,
'user_id'
:
self
.
student_taking_exam
.
id
,
'key'
:
'a_key'
,
'value'
:
'30'
}
response
=
self
.
client
.
put
(
reverse
(
'edx_proctoring.proctored_exam.allowance'
),
allowance_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
client
.
get
(
reverse
(
'edx_proctoring.proctored_exam.allowance'
,
kwargs
=
{
'course_id'
:
proctored_exam
.
course_id
})
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_data
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
len
(
response_data
),
1
)
self
.
assertEqual
(
response_data
[
0
][
'proctored_exam'
][
'course_id'
],
proctored_exam
.
course_id
)
self
.
assertEqual
(
response_data
[
0
][
'key'
],
allowance_data
[
'key'
])
class
TestActiveExamsForUserView
(
LoggedInTestCase
):
class
TestActiveExamsForUserView
(
LoggedInTestCase
):
"""
"""
...
...
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