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
4345c8e0
Commit
4345c8e0
authored
Apr 12, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test to assert that get_items() is not using revision=None as a wildcard
parent
1a3c622b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
cms/djangoapps/contentstore/tests/test_contentstore.py
+27
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
4345c8e0
...
...
@@ -94,6 +94,33 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
return
cnt
def
test_get_items
(
self
):
'''
This verifies a bug we had where the None setting in get_items() meant 'wildcard'
Unfortunately, None = published for the revision field, so get_items() would return
both draft and non-draft copies.
'''
store
=
modulestore
()
draft_store
=
modulestore
(
'draft'
)
import_from_xml
(
store
,
'common/test/data/'
,
[
'simple'
])
html_module
=
draft_store
.
get_item
([
'i4x'
,
'edX'
,
'simple'
,
'html'
,
'test_html'
,
None
])
draft_store
.
clone_item
(
html_module
.
location
,
html_module
.
location
)
# now query get_items() to get this location with revision=None, this should just
# return back a single item (not 2)
items
=
store
.
get_items
([
'i4x'
,
'edX'
,
'simple'
,
'html'
,
'test_html'
,
None
])
self
.
assertEqual
(
len
(
items
),
1
)
self
.
assertFalse
(
getattr
(
items
[
0
],
'is_draft'
,
False
))
# now refetch from the draft store. Note that even though we pass
# None in the revision field, the draft store will replace that with 'draft'
items
=
draft_store
.
get_items
([
'i4x'
,
'edX'
,
'simple'
,
'html'
,
'test_html'
,
None
])
self
.
assertEqual
(
len
(
items
),
1
)
self
.
assertTrue
(
getattr
(
items
[
0
],
'is_draft'
,
False
))
def
test_draft_metadata
(
self
):
'''
This verifies a bug we had where inherited metadata was getting written to the
...
...
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