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
d0d449d2
Commit
d0d449d2
authored
Aug 20, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more robustness in case a user's fullname has unicode characters in it
parent
1bb60c89
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
13 deletions
+28
-13
edx_proctoring/backends/software_secure.py
+6
-5
edx_proctoring/backends/tests/test_software_secure.py
+20
-6
edx_proctoring/tests/test_services.py
+2
-2
No files found.
edx_proctoring/backends/software_secure.py
View file @
d0d449d2
...
@@ -341,10 +341,11 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
...
@@ -341,10 +341,11 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
string
=
""
string
=
""
for
key
in
keys
:
for
key
in
keys
:
value
=
body_json
[
key
]
value
=
body_json
[
key
]
if
str
(
value
)
==
'True'
:
if
isinstance
(
value
,
bool
):
value
=
'true'
if
value
:
if
str
(
value
)
==
'False'
:
value
=
'true'
value
=
'false'
else
:
value
=
'false'
if
isinstance
(
value
,
(
list
,
tuple
)):
if
isinstance
(
value
,
(
list
,
tuple
)):
for
idx
,
arr
in
enumerate
(
value
):
for
idx
,
arr
in
enumerate
(
value
):
if
isinstance
(
arr
,
dict
):
if
isinstance
(
arr
,
dict
):
...
@@ -356,7 +357,7 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
...
@@ -356,7 +357,7 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
else
:
else
:
if
value
!=
""
and
not
value
:
if
value
!=
""
and
not
value
:
value
=
"null"
value
=
"null"
string
+=
str
(
prefix
)
+
str
(
key
)
+
":"
+
str
(
value
)
.
encode
(
'utf-8'
)
+
'
\n
'
string
+=
str
(
prefix
)
+
str
(
key
)
+
":"
+
unicode
(
value
)
.
encode
(
'utf-8'
)
+
'
\n
'
return
string
return
string
...
...
edx_proctoring/backends/tests/test_software_secure.py
View file @
d0d449d2
# coding=utf-8
"""
"""
Tests for the software_secure module
Tests for the software_secure module
"""
"""
...
@@ -140,13 +141,26 @@ class SoftwareSecureTests(TestCase):
...
@@ -140,13 +141,26 @@ class SoftwareSecureTests(TestCase):
Tests to make sure we can parse a fullname which does not have any spaces in it
Tests to make sure we can parse a fullname which does not have any spaces in it
"""
"""
def
mock_profile_service
(
user_id
):
# pylint: disable=unused-argument
set_runtime_service
(
'credit'
,
MockCreditService
())
"""
Mocked out Profile callback endpoint
exam_id
=
create_exam
(
"""
course_id
=
'foo/bar/baz'
,
return
{
'name'
:
'Bono'
}
content_id
=
'content'
,
exam_name
=
'Sample Exam'
,
time_limit_mins
=
10
,
is_proctored
=
True
)
with
HTTMock
(
mock_response_content
):
attempt_id
=
create_exam_attempt
(
exam_id
,
self
.
user
.
id
,
taking_as_proctored
=
True
)
self
.
assertIsNotNone
(
attempt_id
)
def
test_unicode_attempt
(
self
):
"""
Tests to make sure we can handle an attempt when a user's fullname has unicode characters in it
"""
set_runtime_service
(
'
profile'
,
mock_profile_service
)
set_runtime_service
(
'
credit'
,
MockCreditService
(
profile_fullname
=
u'अआईउऊऋऌ अआईउऊऋऌ'
)
)
exam_id
=
create_exam
(
exam_id
=
create_exam
(
course_id
=
'foo/bar/baz'
,
course_id
=
'foo/bar/baz'
,
...
...
edx_proctoring/tests/test_services.py
View file @
d0d449d2
...
@@ -17,13 +17,13 @@ class MockCreditService(object):
...
@@ -17,13 +17,13 @@ class MockCreditService(object):
Simple mock of the Credit Service
Simple mock of the Credit Service
"""
"""
def
__init__
(
self
,
enrollment_mode
=
'verified'
):
def
__init__
(
self
,
enrollment_mode
=
'verified'
,
profile_fullname
=
'Wolfgang von Strucker'
):
"""
"""
Initializer
Initializer
"""
"""
self
.
status
=
{
self
.
status
=
{
'enrollment_mode'
:
enrollment_mode
,
'enrollment_mode'
:
enrollment_mode
,
'profile_fullname'
:
'Wolfgang von Strucker'
,
'profile_fullname'
:
profile_fullname
,
'credit_requirement_status'
:
[]
'credit_requirement_status'
:
[]
}
}
...
...
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