-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #511 from edx/matthugs/add-reviewed_by
Add reviewed_by field to API
- Loading branch information
Showing
7 changed files
with
57 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,10 +178,11 @@ The following fields are optional:: | |
|
||
{ | ||
"start": 123, | ||
"stop": 144 | ||
"stop": 144, | ||
"reviewed_by": "[email protected]" | ||
} | ||
|
||
(Start and stop are seconds relative to the start of the recorded proctoring session.) | ||
Start and stop are seconds relative to the start of the recorded proctoring session. ``reviewed_by`` must be included whenever a specific edX user (e.g. a member of a course team) initiated the review. | ||
|
||
|
||
Instructor Dashboard | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
from django.test import TestCase | ||
from django.utils import translation | ||
from django.contrib.auth.models import User | ||
|
||
from edx_proctoring.backends.rest import BaseRestProctoringProvider | ||
from edx_proctoring.exceptions import BackendProviderCannotRegisterAttempt | ||
|
@@ -218,9 +219,10 @@ def test_stop_exam_attempt(self): | |
status = self.provider.stop_exam_attempt(self.backend_exam['external_id'], attempt_id) | ||
self.assertEqual(status, 'stop') | ||
|
||
@responses.activate | ||
def test_on_review_callback(self): | ||
# on_review_callback should just return the payload | ||
""" | ||
on_review_callback should just return the payload when called without review author | ||
""" | ||
attempt = { | ||
'id': 1, | ||
'external_id': 'abcd', | ||
|
@@ -229,12 +231,48 @@ def test_on_review_callback(self): | |
payload = { | ||
'status': 'verified', | ||
'comments': [ | ||
{'comment': 'something happend', 'status': 'ok'} | ||
{'comment': 'something happened', 'status': 'ok'} | ||
] | ||
} | ||
new_payload = self.provider.on_review_callback(attempt, payload) | ||
self.assertEqual(payload, new_payload) | ||
|
||
def test_on_review_callback_with_reviewer(self): | ||
""" | ||
on_review_callback should find a user if an email is provided | ||
""" | ||
person = User( | ||
username='tester', | ||
email='[email protected]' | ||
) | ||
person.save() | ||
attempt = { | ||
'id': 1, | ||
'external_id': 'abcd', | ||
'user': 1 | ||
} | ||
|
||
def payload_with_email(email): | ||
""" | ||
generic payload with variable email | ||
""" | ||
return { | ||
'status': 'verified', | ||
'comments': [ | ||
{'comment': 'something happened', 'status': 'ok'}, | ||
], | ||
'reviewed_by': email, | ||
} | ||
|
||
payload = payload_with_email('[email protected]') | ||
new_payload = self.provider.on_review_callback(attempt, payload) | ||
self.assertEqual(new_payload['reviewed_by'], person) | ||
|
||
payload = payload_with_email('[email protected]') | ||
new_payload = self.provider.on_review_callback(attempt, payload) | ||
|
||
self.assertEqual(new_payload['reviewed_by'], None) | ||
|
||
def test_get_javascript(self): | ||
self.assertEqual(self.provider.get_javascript(), '') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters