Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
61890e7a
Commit
61890e7a
authored
Mar 09, 2015
by
zubair-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return proper 404 for assets of some invalid course from split modulestore
PLAT-456
parent
c7ebda8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
cms/djangoapps/contentstore/tests/test_contentstore.py
+6
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+9
-1
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
61890e7a
...
...
@@ -888,6 +888,12 @@ class MiscCourseTests(ContentStoreTestCase):
resp
=
self
.
client
.
get_html
(
'/c4x/CDX/123123/asset/invalid.png'
)
self
.
assertEqual
(
resp
.
status_code
,
404
)
# Now test that 404 response is returned when user tries to access
# asset of some invalid course from split ModuleStore
with
self
.
store
.
default_store
(
ModuleStoreEnum
.
Type
.
split
):
resp
=
self
.
client
.
get_html
(
'/c4x/InvalidOrg/InvalidCourse/asset/invalid.png'
)
self
.
assertEqual
(
resp
.
status_code
,
404
)
def
test_delete_course
(
self
):
"""
This test creates a course, makes a draft item, and deletes the course. This will also assert that the
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
61890e7a
...
...
@@ -2474,7 +2474,15 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
"""
Split specific lookup
"""
return
self
.
_lookup_course
(
course_key
)
.
structure
.
get
(
'assets'
,
{})
try
:
course_assets
=
self
.
_lookup_course
(
course_key
)
.
structure
.
get
(
'assets'
,
{})
except
(
InsufficientSpecificationError
,
VersionConflictError
)
as
err
:
log
.
warning
(
u'Error finding assets for org "
%
s" course "
%
s" on asset '
u'request. Either version of course_key is None or invalid.'
,
course_key
.
org
,
course_key
.
course
)
return
{}
return
course_assets
def
_update_course_assets
(
self
,
user_id
,
asset_key
,
update_function
):
"""
...
...
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