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
cb2422a3
Commit
cb2422a3
authored
Jul 09, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit test to demonstrate bug
parent
227205fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
common/lib/xmodule/xmodule/modulestore/mixed.py
+1
-2
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+27
-0
No files found.
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
cb2422a3
...
...
@@ -127,8 +127,7 @@ class MixedModuleStore(ModuleStoreWriteBase):
def
get_item
(
self
,
usage_key
,
depth
=
0
,
**
kwargs
):
"""
This method is explicitly not implemented as we need a course_id to disambiguate
We should be able to fix this when the data-model rearchitecting is done
see parent doc
"""
store
=
self
.
_get_modulestore_for_courseid
(
usage_key
.
course_key
)
return
store
.
get_item
(
usage_key
,
depth
,
**
kwargs
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
cb2422a3
...
...
@@ -17,6 +17,7 @@ from xmodule.modulestore.tests.test_location_mapper import LocMapperSetupSansDja
# before importing the module
from
django.conf
import
settings
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.mongo.base
import
MongoRevisionKey
if
not
settings
.
configured
:
settings
.
configure
()
from
xmodule.modulestore.mixed
import
MixedModuleStore
...
...
@@ -330,6 +331,32 @@ class TestMixedModuleStore(LocMapperSetupSansDjango):
with
self
.
assertRaises
(
ItemNotFoundError
):
self
.
store
.
get_item
(
self
.
writable_chapter_location
)
# create and delete a private vertical with private children
private_vert_loc
=
self
.
course_locations
[
self
.
MONGO_COURSEID
]
.
course_key
.
make_usage_key
(
'vertical'
,
'private'
)
private_vert
=
self
.
store
.
create_and_save_xmodule
(
private_vert_loc
,
self
.
user_id
,
runtime
=
self
.
course
.
runtime
)
self
.
course
.
children
.
append
(
private_vert_loc
)
self
.
store
.
update_item
(
self
.
course
,
self
.
user_id
)
private_leaf_loc
=
self
.
course_locations
[
self
.
MONGO_COURSEID
]
.
course_key
.
make_usage_key
(
'html'
,
'private_leaf'
)
self
.
store
.
create_and_save_xmodule
(
private_leaf_loc
,
self
.
user_id
,
runtime
=
self
.
course
.
runtime
)
private_vert
.
children
.
append
(
private_leaf_loc
)
self
.
store
.
update_item
(
private_vert
,
self
.
user_id
)
# verify pre delete state (just to verify that the test is valid)
self
.
assertTrue
(
hasattr
(
private_vert
,
'is_draft'
)
or
private_vert
.
location
.
branch
==
MongoRevisionKey
.
draft
)
self
.
assertIsNotNone
(
self
.
store
.
get_item
(
private_vert_loc
))
self
.
assertIsNotNone
(
self
.
store
.
get_item
(
private_leaf_loc
))
course
=
self
.
store
.
get_course
(
self
.
course_locations
[
self
.
MONGO_COURSEID
]
.
course_key
,
0
)
self
.
assertIn
(
private_vert_loc
,
course
.
children
)
# delete the vertical and ensure the course no longer points to it
self
.
store
.
delete_item
(
private_vert_loc
,
self
.
user_id
)
with
self
.
assertRaises
(
ItemNotFoundError
):
self
.
store
.
get_item
(
private_vert_loc
)
with
self
.
assertRaises
(
ItemNotFoundError
):
self
.
store
.
get_item
(
private_leaf_loc
)
course
=
self
.
store
.
get_course
(
self
.
course_locations
[
self
.
MONGO_COURSEID
]
.
course_key
,
0
)
self
.
assertNotIn
(
private_vert_loc
,
course
.
children
)
@ddt.data
(
'draft'
,
'split'
)
def
test_get_courses
(
self
,
default_ms
):
self
.
initdb
(
default_ms
)
...
...
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