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
f411e227
Commit
f411e227
authored
Aug 08, 2015
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #78 from edx/cdodge/allow-for-simulating-callback
allow for simulated postbacks for exam verification
parents
ce5b7780
82b7c109
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
2 deletions
+50
-2
edx_proctoring/backends/software_secure.py
+7
-1
edx_proctoring/backends/tests/test_software_secure.py
+41
-0
settings.py
+2
-1
No files found.
edx_proctoring/backends/software_secure.py
View file @
f411e227
...
@@ -12,6 +12,8 @@ import datetime
...
@@ -12,6 +12,8 @@ import datetime
import
json
import
json
import
logging
import
logging
from
django.conf
import
settings
from
edx_proctoring.backends.backend
import
ProctoringBackendProvider
from
edx_proctoring.backends.backend
import
ProctoringBackendProvider
from
edx_proctoring.exceptions
import
(
from
edx_proctoring.exceptions
import
(
BackendProvideCannotRegisterAttempt
,
BackendProvideCannotRegisterAttempt
,
...
@@ -170,7 +172,11 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
...
@@ -170,7 +172,11 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
# note that SoftwareSecure might send a case insensitive
# note that SoftwareSecure might send a case insensitive
# ssiRecordLocator than what it returned when we registered the
# ssiRecordLocator than what it returned when we registered the
# exam
# exam
if
attempt_obj
.
external_id
.
lower
()
!=
external_id
.
lower
():
match
=
(
attempt_obj
.
external_id
.
lower
()
==
external_id
.
lower
()
or
settings
.
PROCTORING_SETTINGS
.
get
(
'ALLOW_CALLBACK_SIMULATION'
,
False
)
)
if
not
match
:
err_msg
=
(
err_msg
=
(
'Found attempt_code {attempt_code}, but the recorded external_id did not '
'Found attempt_code {attempt_code}, but the recorded external_id did not '
'match the ssiRecordLocator that had been recorded previously. Has {existing} '
'match the ssiRecordLocator that had been recorded previously. Has {existing} '
...
...
edx_proctoring/backends/tests/test_software_secure.py
View file @
f411e227
...
@@ -30,6 +30,7 @@ from edx_proctoring.exceptions import (
...
@@ -30,6 +30,7 @@ from edx_proctoring.exceptions import (
from
edx_proctoring
.
models
import
(
from
edx_proctoring
.
models
import
(
ProctoredExamSoftwareSecureReview
,
ProctoredExamSoftwareSecureReview
,
ProctoredExamSoftwareSecureComment
,
ProctoredExamSoftwareSecureComment
,
ProctoredExamStudentAttemptStatus
,
)
)
from
edx_proctoring.backends.tests.test_review_payload
import
TEST_REVIEW_PAYLOAD
from
edx_proctoring.backends.tests.test_review_payload
import
TEST_REVIEW_PAYLOAD
...
@@ -349,6 +350,46 @@ class SoftwareSecureTests(TestCase):
...
@@ -349,6 +350,46 @@ class SoftwareSecureTests(TestCase):
with
self
.
assertRaises
(
ProctoredExamSuspiciousLookup
):
with
self
.
assertRaises
(
ProctoredExamSuspiciousLookup
):
provider
.
on_review_callback
(
json
.
loads
(
test_payload
))
provider
.
on_review_callback
(
json
.
loads
(
test_payload
))
@patch.dict
(
'django.conf.settings.PROCTORING_SETTINGS'
,
{
'ALLOW_CALLBACK_SIMULATION'
:
True
})
def
test_allow_simulated_callbacks
(
self
):
"""
Verify that the configuration switch to
not do confirmation of external_id/ssiRecordLocators
"""
provider
=
get_backend_provider
()
exam_id
=
create_exam
(
course_id
=
'foo/bar/baz'
,
content_id
=
'content'
,
exam_name
=
'Sample Exam'
,
time_limit_mins
=
10
,
is_proctored
=
True
)
# be sure to use the mocked out SoftwareSecure handlers
with
HTTMock
(
mock_response_content
):
attempt_id
=
create_exam_attempt
(
exam_id
,
self
.
user
.
id
,
taking_as_proctored
=
True
)
attempt
=
get_exam_attempt_by_id
(
attempt_id
)
self
.
assertIsNotNone
(
attempt
[
'external_id'
])
test_payload
=
Template
(
TEST_REVIEW_PAYLOAD
)
.
substitute
(
attempt_code
=
attempt
[
'attempt_code'
],
external_id
=
'bogus'
)
# this should not raise an exception since we have
# the ALLOW_CALLBACK_SIMULATION override
provider
.
on_review_callback
(
json
.
loads
(
test_payload
))
attempt
=
get_exam_attempt_by_id
(
attempt_id
)
self
.
assertEqual
(
attempt
[
'status'
],
ProctoredExamStudentAttemptStatus
.
verified
)
def
test_review_on_archived_attempt
(
self
):
def
test_review_on_archived_attempt
(
self
):
"""
"""
Make sure we can process a review report for
Make sure we can process a review report for
...
...
settings.py
View file @
f411e227
...
@@ -88,5 +88,6 @@ PROCTORING_SETTINGS = {
...
@@ -88,5 +88,6 @@ PROCTORING_SETTINGS = {
'faq'
:
''
,
'faq'
:
''
,
'contact_us'
:
''
,
'contact_us'
:
''
,
'tech_requirements'
:
''
,
'tech_requirements'
:
''
,
}
},
'ALLOW_CALLBACK_SIMULATION'
:
False
}
}
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