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
deda4868
Commit
deda4868
authored
Jul 10, 2017
by
Tyler Hallada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests on Django 1.11
parent
bf8c3672
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
33 deletions
+32
-33
edx_proctoring/api.py
+17
-22
edx_proctoring/backends/tests/test_software_secure.py
+2
-1
edx_proctoring/callbacks.py
+5
-7
edx_proctoring/management/commands/tests/test_set_attempt_status.py
+2
-0
edx_proctoring/tests/test_api.py
+2
-1
edx_proctoring/tests/test_email.py
+2
-1
edx_proctoring/tests/test_student_view.py
+2
-1
No files found.
edx_proctoring/api.py
View file @
deda4868
...
...
@@ -14,7 +14,7 @@ import pytz
from
django.utils.translation
import
ugettext
as
_
,
ugettext_noop
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.template
import
Context
,
loader
from
django.template
import
loader
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
django.core.mail.message
import
EmailMessage
...
...
@@ -979,18 +979,16 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam
username
=
user
.
username
,
)
body
=
email_template
.
render
(
Context
({
'username'
:
user
.
username
,
'course_url'
:
course_url
,
'course_name'
:
course_name
,
'exam_name'
:
exam_name
,
'status'
:
status
,
'platform'
:
constants
.
PLATFORM_NAME
,
'contact_email'
:
constants
.
CONTACT_EMAIL
,
'support_email_subject'
:
support_email_subject
,
})
)
body
=
email_template
.
render
({
'username'
:
user
.
username
,
'course_url'
:
course_url
,
'course_name'
:
course_name
,
'exam_name'
:
exam_name
,
'status'
:
status
,
'platform'
:
constants
.
PLATFORM_NAME
,
'contact_email'
:
constants
.
CONTACT_EMAIL
,
'support_email_subject'
:
support_email_subject
,
})
email
=
EmailMessage
(
body
=
body
,
...
...
@@ -1513,7 +1511,6 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
if
student_view_template
:
template
=
loader
.
get_template
(
student_view_template
)
django_context
=
Context
(
context
)
allowed_time_limit_mins
=
attempt
[
'allowed_time_limit_mins'
]
if
attempt
else
None
...
...
@@ -1547,7 +1544,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
except
NoReverseMatch
:
log
.
exception
(
"Can't find progress url for course
%
s"
,
course_id
)
django_
context
.
update
({
context
.
update
({
'total_time'
:
total_time
,
'hide_extra_time_footer'
:
hide_extra_time_footer
,
'will_be_revealed'
:
has_due_date
and
not
exam
[
'hide_after_due'
],
...
...
@@ -1562,7 +1559,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
args
=
[
attempt
[
'id'
]]
)
if
attempt
else
''
,
})
return
template
.
render
(
django_
context
)
return
template
.
render
(
context
)
def
_calculate_allowed_mins
(
due_datetime
,
allowed_mins
):
...
...
@@ -1663,9 +1660,8 @@ def _get_practice_exam_view(exam, context, exam_id, user_id, course_id):
if
student_view_template
:
template
=
loader
.
get_template
(
student_view_template
)
django_context
=
Context
(
context
)
django_context
.
update
(
_get_proctored_exam_context
(
exam
,
attempt
,
course_id
,
is_practice_exam
=
True
))
return
template
.
render
(
django_context
)
context
.
update
(
_get_proctored_exam_context
(
exam
,
attempt
,
course_id
,
is_practice_exam
=
True
))
return
template
.
render
(
context
)
def
_get_proctored_exam_view
(
exam
,
context
,
exam_id
,
user_id
,
course_id
):
...
...
@@ -1807,9 +1803,8 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
if
student_view_template
:
template
=
loader
.
get_template
(
student_view_template
)
django_context
=
Context
(
context
)
django_context
.
update
(
_get_proctored_exam_context
(
exam
,
attempt
,
course_id
))
return
template
.
render
(
django_context
)
context
.
update
(
_get_proctored_exam_context
(
exam
,
attempt
,
course_id
))
return
template
.
render
(
context
)
def
get_student_view
(
user_id
,
course_id
,
content_id
,
...
...
edx_proctoring/backends/tests/test_software_secure.py
View file @
deda4868
...
...
@@ -8,7 +8,7 @@ from __future__ import absolute_import
import
json
import
ddt
from
mock
import
patch
from
mock
import
MagicMock
,
patch
from
httmock
import
all_requests
,
HTTMock
from
django.test
import
TestCase
...
...
@@ -87,6 +87,7 @@ def mock_response_error(url, request): # pylint: disable=unused-argument
}
}
)
@patch
(
'django.core.urlresolvers.reverse'
,
MagicMock
)
@ddt.ddt
class
SoftwareSecureTests
(
TestCase
):
"""
...
...
edx_proctoring/callbacks.py
View file @
deda4868
...
...
@@ -3,7 +3,7 @@ Various callback paths that support callbacks from SoftwareSecure
"""
import
logging
from
django.template
import
Context
,
loader
from
django.template
import
loader
from
django.conf
import
settings
from
django.http
import
HttpResponse
...
...
@@ -52,12 +52,10 @@ def start_exam_callback(request, attempt_code): # pylint: disable=unused-argume
template
=
loader
.
get_template
(
'proctored_exam/proctoring_launch_callback.html'
)
return
HttpResponse
(
template
.
render
(
Context
({
'platform_name'
:
settings
.
PLATFORM_NAME
,
'link_urls'
:
settings
.
PROCTORING_SETTINGS
.
get
(
'LINK_URLS'
,
{})
})
)
template
.
render
({
'platform_name'
:
settings
.
PLATFORM_NAME
,
'link_urls'
:
settings
.
PROCTORING_SETTINGS
.
get
(
'LINK_URLS'
,
{})
})
)
...
...
edx_proctoring/management/commands/tests/test_set_attempt_status.py
View file @
deda4868
...
...
@@ -5,6 +5,7 @@ Tests for the set_attempt_status management command
from
__future__
import
absolute_import
from
datetime
import
datetime
from
mock
import
MagicMock
,
patch
import
pytz
from
edx_proctoring.tests.utils
import
LoggedInTestCase
...
...
@@ -18,6 +19,7 @@ from edx_proctoring.tests.test_services import (
from
edx_proctoring.runtime
import
set_runtime_service
@patch
(
'django.core.urlresolvers.reverse'
,
MagicMock
)
class
SetAttemptStatusTests
(
LoggedInTestCase
):
"""
Coverage of the set_attempt_status.py file
...
...
edx_proctoring/tests/test_api.py
View file @
deda4868
...
...
@@ -10,7 +10,7 @@ from __future__ import absolute_import
from
datetime
import
datetime
,
timedelta
import
ddt
from
freezegun
import
freeze_time
from
mock
import
patch
from
mock
import
MagicMock
,
patch
import
pytz
from
edx_proctoring.api
import
(
...
...
@@ -75,6 +75,7 @@ from .test_services import (
from
.utils
import
ProctoredExamTestCase
@patch
(
'django.core.urlresolvers.reverse'
,
MagicMock
)
@ddt.ddt
class
ProctoredExamApiTests
(
ProctoredExamTestCase
):
"""
...
...
edx_proctoring/tests/test_email.py
View file @
deda4868
...
...
@@ -7,7 +7,7 @@ from __future__ import absolute_import
import
ddt
from
django.core
import
mail
from
mock
import
patch
from
mock
import
MagicMock
,
patch
from
edx_proctoring.api
import
(
update_attempt_status
,
...
...
@@ -25,6 +25,7 @@ from .utils import (
)
@patch
(
'django.core.urlresolvers.reverse'
,
MagicMock
)
@ddt.ddt
class
ProctoredExamEmailTests
(
ProctoredExamTestCase
):
"""
...
...
edx_proctoring/tests/test_student_view.py
View file @
deda4868
...
...
@@ -10,7 +10,7 @@ from __future__ import absolute_import
from
datetime
import
datetime
,
timedelta
import
ddt
from
freezegun
import
freeze_time
from
mock
import
patch
from
mock
import
MagicMock
,
patch
import
pytz
from
edx_proctoring.api
import
(
...
...
@@ -33,6 +33,7 @@ from .test_services import MockCreditServiceWithCourseEndDate
from
.utils
import
ProctoredExamTestCase
@patch
(
'django.core.urlresolvers.reverse'
,
MagicMock
)
@ddt.ddt
class
ProctoredExamStudentViewTests
(
ProctoredExamTestCase
):
"""
...
...
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