Commit d6ba142e by Chris Dodge

SoftwareSecure does not allow colons in exam names - replace them with dashes

parent 1bcc2308
...@@ -355,6 +355,8 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider): ...@@ -355,6 +355,8 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
now = datetime.datetime.utcnow() now = datetime.datetime.utcnow()
start_time_str = now.strftime("%a, %d %b %Y %H:%M:%S GMT") start_time_str = now.strftime("%a, %d %b %Y %H:%M:%S GMT")
end_time_str = (now + datetime.timedelta(minutes=time_limit_mins)).strftime("%a, %d %b %Y %H:%M:%S GMT") end_time_str = (now + datetime.timedelta(minutes=time_limit_mins)).strftime("%a, %d %b %Y %H:%M:%S GMT")
# note, SoftwareSecure does not appear to allow colons in the exam names
exam_name = exam['exam_name'].replace(':', '-')
return { return {
"examCode": attempt_code, "examCode": attempt_code,
"organization": self.organization, "organization": self.organization,
...@@ -365,7 +367,7 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider): ...@@ -365,7 +367,7 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
"reviewerNotes": reviewer_notes, "reviewerNotes": reviewer_notes,
"examPassword": self._encrypt_password(self.crypto_key, attempt_code), "examPassword": self._encrypt_password(self.crypto_key, attempt_code),
"examSponsor": self.exam_sponsor, "examSponsor": self.exam_sponsor,
"examName": exam['exam_name'], "examName": exam_name,
"ssiProduct": 'rp-now', "ssiProduct": 'rp-now',
# need to pass in a URL to the LMS? # need to pass in a URL to the LMS?
"examUrl": callback_url, "examUrl": callback_url,
......
...@@ -219,7 +219,7 @@ class SoftwareSecureTests(TestCase): ...@@ -219,7 +219,7 @@ class SoftwareSecureTests(TestCase):
exam_id = create_exam( exam_id = create_exam(
course_id='foo/bar/baz', course_id='foo/bar/baz',
content_id='content', content_id='content',
exam_name='Sample Exam', exam_name='Sample Exam with : Colon',
time_limit_mins=10, time_limit_mins=10,
is_proctored=True is_proctored=True
) )
...@@ -236,6 +236,13 @@ class SoftwareSecureTests(TestCase): ...@@ -236,6 +236,13 @@ class SoftwareSecureTests(TestCase):
# assert that we use the default that is defined in system configuration # assert that we use the default that is defined in system configuration
self.assertEqual(result['reviewerNotes'], constants.DEFAULT_SOFTWARE_SECURE_REVIEW_POLICY) self.assertEqual(result['reviewerNotes'], constants.DEFAULT_SOFTWARE_SECURE_REVIEW_POLICY)
# the check that if a colon was passed in for the exam name, then the colon was changed to
# a dash. This is because SoftwareSecure cannot handle a colon in the exam name
if ':' in exam['exam_name']:
self.assertIn('-', result['examName'])
self.assertNotIn(':', result['examName'])
return result return result
with HTTMock(mock_response_content): with HTTMock(mock_response_content):
......
...@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths): ...@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup( setup(
name='edx-proctoring', name='edx-proctoring',
version='0.10.17', version='0.10.18',
description='Proctoring subsystem for Open edX', description='Proctoring subsystem for Open edX',
long_description=open('README.md').read(), long_description=open('README.md').read(),
author='edX', author='edX',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment