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
d6e8ff15
Commit
d6e8ff15
authored
Aug 26, 2016
by
Diana Huang
Committed by
GitHub
Aug 26, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #303 from edx/diana/catch-none
Don't error out if the credit service returns None.
parents
41f131cf
398370d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
edx_proctoring/api.py
+11
-1
edx_proctoring/tests/test_api.py
+15
-1
edx_proctoring/tests/test_services.py
+12
-0
No files found.
edx_proctoring/api.py
View file @
d6e8ff15
...
...
@@ -899,9 +899,19 @@ def update_attempt_status(exam_id, user_id, to_status, raise_if_not_found=True,
return_course_info
=
True
)
default_name
=
_
(
'your course'
)
if
credit_state
:
course_name
=
credit_state
.
get
(
'course_name'
,
default_name
)
else
:
course_name
=
default_name
log
.
info
(
"Could not find credit_state for user id
%
r in the course
%
r."
,
exam_attempt_obj
.
user_id
,
exam_attempt_obj
.
proctored_exam
.
course_id
)
send_proctoring_attempt_status_email
(
exam_attempt_obj
,
c
redit_state
.
get
(
'course_name'
,
_
(
'your course'
))
c
ourse_name
)
# emit an anlytics event based on the state transition
...
...
edx_proctoring/tests/test_api.py
View file @
d6e8ff15
...
...
@@ -72,7 +72,7 @@ from .utils import (
from
edx_proctoring.tests.test_services
import
(
MockCreditService
,
MockCreditServiceWithCourseEndDate
,
MockInstructorService
,
MockInstructorService
,
MockCreditServiceNone
,
)
from
edx_proctoring.runtime
import
set_runtime_service
,
get_runtime_service
from
eventtracking
import
tracker
...
...
@@ -2303,6 +2303,20 @@ class ProctoredExamApiTests(LoggedInTestCase):
)
)
def
test_update_attempt_without_credit_state
(
self
):
"""
Test updating an attempt that does not have a corresponding credit state.
"""
exam_attempt
=
self
.
_create_started_exam_attempt
()
set_runtime_service
(
'credit'
,
MockCreditServiceNone
())
new_attempt
=
update_attempt_status
(
exam_attempt
.
proctored_exam_id
,
self
.
user
.
id
,
ProctoredExamStudentAttemptStatus
.
verified
)
self
.
assertEqual
(
new_attempt
,
exam_attempt
.
id
)
@ddt.data
(
(
ProctoredExamStudentAttemptStatus
.
eligible
,
{
...
...
edx_proctoring/tests/test_services.py
View file @
d6e8ff15
...
...
@@ -102,6 +102,18 @@ class MockCreditServiceWithCourseEndDate(MockCreditService):
return
self
.
status
class
MockCreditServiceNone
(
MockCreditService
):
"""
Mock Credit Service that returns None for the credit state every time.
"""
def
get_credit_state
(
self
,
user_id
,
course_key
,
return_course_info
=
False
):
# pylint: disable=unused-argument
"""
Mock implementation
"""
return
None
class
MockInstructorService
(
object
):
"""
Simple mock of the Instructor Service
...
...
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