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
e3080a52
Commit
e3080a52
authored
Aug 30, 2017
by
attiyaishaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDUCATOR-1256 Fix 500 error when user is not enrolled.
parent
47ce2865
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
edx_proctoring/api.py
+1
-1
edx_proctoring/tests/test_student_view.py
+19
-1
No files found.
edx_proctoring/api.py
View file @
e3080a52
...
@@ -1896,7 +1896,7 @@ def get_student_view(user_id, course_id, content_id,
...
@@ -1896,7 +1896,7 @@ def get_student_view(user_id, course_id, content_id,
# call service to get course end date.
# call service to get course end date.
credit_state
=
credit_service
.
get_credit_state
(
user_id
,
course_id
,
return_course_info
=
True
)
credit_state
=
credit_service
.
get_credit_state
(
user_id
,
course_id
,
return_course_info
=
True
)
course_end_date
=
credit_state
.
get
(
'course_end_date'
,
None
)
course_end_date
=
credit_state
.
get
(
'course_end_date'
)
if
credit_state
else
None
exam_id
=
None
exam_id
=
None
try
:
try
:
...
...
edx_proctoring/tests/test_student_view.py
View file @
e3080a52
...
@@ -29,7 +29,7 @@ from edx_proctoring.models import (
...
@@ -29,7 +29,7 @@ from edx_proctoring.models import (
)
)
from
edx_proctoring.runtime
import
set_runtime_service
from
edx_proctoring.runtime
import
set_runtime_service
from
.test_services
import
MockCreditServiceWithCourseEndDate
from
.test_services
import
MockCreditServiceWithCourseEndDate
,
MockCreditServiceNone
from
.utils
import
ProctoredExamTestCase
from
.utils
import
ProctoredExamTestCase
...
@@ -388,6 +388,24 @@ class ProctoredExamStudentViewTests(ProctoredExamTestCase):
...
@@ -388,6 +388,24 @@ class ProctoredExamStudentViewTests(ProctoredExamTestCase):
)
)
)
)
def
test_student_response_without_credit_state
(
self
):
"""
Test that response is not None for users who are not enrolled.
"""
set_runtime_service
(
'credit'
,
MockCreditServiceNone
())
rendered_response
=
get_student_view
(
user_id
=
self
.
user_id
,
course_id
=
self
.
course_id
,
content_id
=
self
.
content_id
,
context
=
{
'is_proctored'
:
True
,
'display_name'
:
self
.
exam_name
,
'default_time_limit_mins'
:
90
},
user_role
=
'student'
)
self
.
assertIsNotNone
(
rendered_response
)
@ddt.data
(
False
,
True
)
@ddt.data
(
False
,
True
)
def
test_get_studentview_unstarted_exam
(
self
,
allow_proctoring_opt_out
):
def
test_get_studentview_unstarted_exam
(
self
,
allow_proctoring_opt_out
):
"""
"""
...
...
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