Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
8f95ae7a
Commit
8f95ae7a
authored
Mar 19, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warning for submission in Studio preview
parent
7a4bb68b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
apps/openassessment/xblock/submission_mixin.py
+3
-1
apps/openassessment/xblock/test/test_submission.py
+11
-3
No files found.
apps/openassessment/xblock/submission_mixin.py
View file @
8f95ae7a
...
...
@@ -61,7 +61,9 @@ class SubmissionMixin(object):
# Short-circuit if no user is defined (as in Studio Preview mode)
# Since students can't submit, they will never be able to progress in the workflow
if
student_item_dict
[
'student_id'
]
is
None
:
# Studio Preview provides an anonymous student ID, so we need to check the scope ids directly
# to check that we are in preview mode.
if
self
.
scope_ids
.
user_id
is
None
:
return
False
,
'ENOPREVIEW'
,
self
.
submit_errors
[
'ENOPREVIEW'
]
workflow
=
self
.
get_workflow_info
()
...
...
apps/openassessment/xblock/test/test_submission.py
View file @
8f95ae7a
...
...
@@ -3,7 +3,7 @@ Test submission to the OpenAssessment XBlock.
"""
import
json
from
mock
import
patch
from
mock
import
patch
,
Mock
from
submissions
import
api
as
sub_api
from
submissions.api
import
SubmissionRequestError
,
SubmissionInternalError
from
openassessment.xblock.submission_mixin
import
SubmissionMixin
...
...
@@ -50,7 +50,16 @@ class SubmissionTest(XBlockHandlerTestCase):
# In Studio preview mode, the runtime sets the user ID to None
@scenario
(
'data/basic_scenario.xml'
,
user_id
=
None
)
def
test_cannot_submit_in_preview_mode
(
self
,
xblock
,):
# The Studio runtime apparently provides an anonymous student ID,
# even though we're running in Preview mode. We should check the scope id
# to determine whether we're in Preview mode or not.
xblock
.
xmodule_runtime
=
Mock
(
course_id
=
'test_course'
,
anonymous_student_id
=
'test_student'
)
resp
=
self
.
request
(
xblock
,
'submit'
,
self
.
SUBMISSION
,
response_format
=
'json'
)
self
.
assertFalse
(
resp
[
0
])
self
.
assertEqual
(
resp
[
1
],
"ENOPREVIEW"
)
self
.
assertEqual
(
resp
[
2
],
"To submit a response, view this component in Preview or Live mode."
)
\ No newline at end of file
self
.
assertEqual
(
resp
[
2
],
"To submit a response, view this component in Preview or Live mode."
)
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