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
70c6eaaa
Commit
70c6eaaa
authored
Mar 19, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #170 from edx/will/fix-studio-preview-warning
Fix warning for submission in Studio preview
parents
3600e562
8f95ae7a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
apps/openassessment/xblock/submission_mixin.py
+3
-1
apps/openassessment/xblock/test/test_submission.py
+10
-1
No files found.
apps/openassessment/xblock/submission_mixin.py
View file @
70c6eaaa
...
@@ -61,7 +61,9 @@ class SubmissionMixin(object):
...
@@ -61,7 +61,9 @@ class SubmissionMixin(object):
# Short-circuit if no user is defined (as in Studio Preview mode)
# 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
# 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'
]
return
False
,
'ENOPREVIEW'
,
self
.
submit_errors
[
'ENOPREVIEW'
]
workflow
=
self
.
get_workflow_info
()
workflow
=
self
.
get_workflow_info
()
...
...
apps/openassessment/xblock/test/test_submission.py
View file @
70c6eaaa
...
@@ -3,7 +3,7 @@ Test submission to the OpenAssessment XBlock.
...
@@ -3,7 +3,7 @@ Test submission to the OpenAssessment XBlock.
"""
"""
import
json
import
json
from
mock
import
patch
from
mock
import
patch
,
Mock
from
submissions
import
api
as
sub_api
from
submissions
import
api
as
sub_api
from
submissions.api
import
SubmissionRequestError
,
SubmissionInternalError
from
submissions.api
import
SubmissionRequestError
,
SubmissionInternalError
from
openassessment.xblock.submission_mixin
import
SubmissionMixin
from
openassessment.xblock.submission_mixin
import
SubmissionMixin
...
@@ -50,6 +50,15 @@ class SubmissionTest(XBlockHandlerTestCase):
...
@@ -50,6 +50,15 @@ class SubmissionTest(XBlockHandlerTestCase):
# In Studio preview mode, the runtime sets the user ID to None
# In Studio preview mode, the runtime sets the user ID to None
@scenario
(
'data/basic_scenario.xml'
,
user_id
=
None
)
@scenario
(
'data/basic_scenario.xml'
,
user_id
=
None
)
def
test_cannot_submit_in_preview_mode
(
self
,
xblock
,):
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'
)
resp
=
self
.
request
(
xblock
,
'submit'
,
self
.
SUBMISSION
,
response_format
=
'json'
)
self
.
assertFalse
(
resp
[
0
])
self
.
assertFalse
(
resp
[
0
])
self
.
assertEqual
(
resp
[
1
],
"ENOPREVIEW"
)
self
.
assertEqual
(
resp
[
1
],
"ENOPREVIEW"
)
...
...
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