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
f560bd62
Commit
f560bd62
authored
Jul 29, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
put the full name into the credit service so that we don't need that profile service
parent
3d8783df
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
edx_proctoring/api.py
+4
-4
edx_proctoring/backends/tests/test_software_secure.py
+26
-8
No files found.
edx_proctoring/api.py
View file @
f560bd62
...
@@ -248,10 +248,10 @@ def create_exam_attempt(exam_id, user_id, taking_as_proctored=False):
...
@@ -248,10 +248,10 @@ def create_exam_attempt(exam_id, user_id, taking_as_proctored=False):
# get the name of the user, if the service is available
# get the name of the user, if the service is available
full_name
=
None
full_name
=
None
profile_service
=
get_runtime_service
(
'profile
'
)
credit_service
=
get_runtime_service
(
'credit
'
)
if
profile
_service
:
if
credit
_service
:
profile
=
profile_service
(
user_id
)
credit_state
=
credit_service
.
get_credit_state
(
user_id
,
exam
[
'course_id'
]
)
full_name
=
profile
[
'
name'
]
full_name
=
credit_state
[
'profile_full
name'
]
# now call into the backend provider to register exam attempt
# now call into the backend provider to register exam attempt
external_id
=
get_backend_provider
()
.
register_exam_attempt
(
external_id
=
get_backend_provider
()
.
register_exam_attempt
(
...
...
edx_proctoring/backends/tests/test_software_secure.py
View file @
f560bd62
...
@@ -57,6 +57,30 @@ def mock_response_error(url, request): # pylint: disable=unused-argument
...
@@ -57,6 +57,30 @@ def mock_response_error(url, request): # pylint: disable=unused-argument
}
}
class
MockCreditService
(
object
):
"""
Simple mock of the Credit Service
"""
def
get_credit_state
(
self
,
user_id
,
course_key
):
# pylint: disable=unused-argument
"""
Mock implementation
"""
return
{
'enrollment_mode'
:
'verified'
,
'profile_fullname'
:
'Wolfgang von Strucker'
,
'credit_requirement_status'
:
[]
}
def
set_credit_requirement_status
(
self
,
user_id
,
course_key
,
req_namespace
,
req_name
,
status
=
"satisfied"
,
reason
=
None
):
# pylint: disable=unused-argument
"""
Mock implementation
"""
pass
@patch
(
@patch
(
'django.conf.settings.PROCTORING_BACKEND_PROVIDER'
,
'django.conf.settings.PROCTORING_BACKEND_PROVIDER'
,
{
{
...
@@ -84,19 +108,13 @@ class SoftwareSecureTests(TestCase):
...
@@ -84,19 +108,13 @@ class SoftwareSecureTests(TestCase):
self
.
user
=
User
(
username
=
'foo'
,
email
=
'foo@bar.com'
)
self
.
user
=
User
(
username
=
'foo'
,
email
=
'foo@bar.com'
)
self
.
user
.
save
()
self
.
user
.
save
()
def
mock_profile_service
(
user_id
):
# pylint: disable=unused-argument
set_runtime_service
(
'credit'
,
MockCreditService
())
"""
Mocked out Profile callback endpoint
"""
return
{
'name'
:
'Wolfgang von Strucker'
}
set_runtime_service
(
'profile'
,
mock_profile_service
)
def
tearDown
(
self
):
def
tearDown
(
self
):
"""
"""
When tests are done
When tests are done
"""
"""
set_runtime_service
(
'
profile
'
,
None
)
set_runtime_service
(
'
credit
'
,
None
)
def
test_provider_instance
(
self
):
def
test_provider_instance
(
self
):
"""
"""
...
...
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