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
fe69b6a7
Commit
fe69b6a7
authored
Nov 23, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't allow a blank exam name to be registered with SoftwareSecure otherwise the API call will fail
parent
ab676cbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
edx_proctoring/backends/software_secure.py
+8
-0
edx_proctoring/backends/tests/test_software_secure.py
+28
-8
No files found.
edx_proctoring/backends/software_secure.py
View file @
fe69b6a7
...
...
@@ -379,8 +379,16 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
# remove all illegal characters from the exam name
exam_name
=
exam
[
'exam_name'
]
exam_name
=
unicodedata
.
normalize
(
'NFKD'
,
exam_name
)
.
encode
(
'ascii'
,
'ignore'
)
for
character
in
SOFTWARE_SECURE_INVALID_CHARS
:
exam_name
=
exam_name
.
replace
(
character
,
'_'
)
# if exam_name is blank because we can't normalize a potential unicode (like Chinese) exam name
# into something ascii-like, then we have use a default otherwise
# SoftwareSecure will fail on the exam registration API call
if
not
exam_name
:
exam_name
=
'Proctored Exam'
return
{
"examCode"
:
attempt_code
,
"organization"
:
self
.
organization
,
...
...
edx_proctoring/backends/tests/test_software_secure.py
View file @
fe69b6a7
...
...
@@ -292,17 +292,37 @@ class SoftwareSecureTests(TestCase):
result
=
get_backend_provider
(
emphemeral
=
True
)
.
_get_payload
(
exam
,
context
)
# pylint: disable=protected-access
self
.
assertFalse
(
isinstance
(
result
[
'examName'
],
unicode
))
self
.
assertTrue
(
is_ascii
(
result
[
'examName'
]))
self
.
assertGreater
(
len
(
result
[
'examName'
]),
0
)
return
result
exam_id
=
create_exam
(
course_id
=
'foo/bar/baz'
,
content_id
=
'content with unicode characters'
,
exam_name
=
u'Klüft skräms inför på fédéral électoral große'
,
time_limit_mins
=
10
,
is_proctored
=
True
)
with
HTTMock
(
mock_response_content
):
exam_id
=
create_exam
(
course_id
=
'foo/bar/baz'
,
content_id
=
'content with unicode characters'
,
exam_name
=
u'Klüft skräms inför på fédéral électoral große'
,
time_limit_mins
=
10
,
is_proctored
=
True
)
# patch the _get_payload method on the backend provider
with
patch
.
object
(
get_backend_provider
(),
'_get_payload'
,
assert_get_payload_mock_unicode_characters
):
# pylint: disable=protected-access
attempt_id
=
create_exam_attempt
(
exam_id
,
self
.
user
.
id
,
taking_as_proctored
=
True
)
self
.
assertGreater
(
attempt_id
,
0
)
# now try with an eastern language (Chinese)
exam_id
=
create_exam
(
course_id
=
'foo/bar/baz'
,
content_id
=
'content with chinese characters'
,
exam_name
=
u'到处群魔乱舞'
,
time_limit_mins
=
10
,
is_proctored
=
True
)
# patch the _get_payload method on the backend provider
with
patch
.
object
(
get_backend_provider
(),
'_get_payload'
,
assert_get_payload_mock_unicode_characters
):
# pylint: disable=protected-access
attempt_id
=
create_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