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
197f5253
Commit
197f5253
authored
Mar 28, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some unit tests
parent
c7bafdda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
cms/djangoapps/contentstore/tests/test_contentstore.py
+38
-0
cms/envs/test.py
+4
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
197f5253
...
...
@@ -85,6 +85,44 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
def
test_edit_unit_full
(
self
):
self
.
check_edit_unit
(
'full'
)
def
_get_draft_counts
(
self
,
item
):
cnt
=
1
if
getattr
(
item
,
'is_draft'
,
False
)
else
0
print
"Checking {0}. Result = {1}"
.
format
(
item
.
location
,
cnt
)
for
child
in
item
.
get_children
():
cnt
=
cnt
+
self
.
_get_draft_counts
(
child
)
return
cnt
def
test_get_depth_with_drafts
(
self
):
import_from_xml
(
modulestore
(),
'common/test/data/'
,
[
'simple'
])
course
=
modulestore
(
'draft'
)
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'simple'
,
'course'
,
'2012_Fall'
,
None
]),
depth
=
None
)
# make sure no draft items have been returned
num_drafts
=
self
.
_get_draft_counts
(
course
)
self
.
assertEqual
(
num_drafts
,
0
)
problem
=
modulestore
(
'draft'
)
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'simple'
,
'problem'
,
'ps01-simple'
,
None
]))
# put into draft
modulestore
(
'draft'
)
.
clone_item
(
problem
.
location
,
problem
.
location
)
# make sure we can query that item and verify that it is a draft
draft_problem
=
modulestore
(
'draft'
)
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'simple'
,
'problem'
,
'ps01-simple'
,
None
]))
self
.
assertTrue
(
getattr
(
draft_problem
,
'is_draft'
,
False
))
#now requery with depth
course
=
modulestore
(
'draft'
)
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'simple'
,
'course'
,
'2012_Fall'
,
None
]),
depth
=
None
)
# make sure no draft items have been returned
num_drafts
=
self
.
_get_draft_counts
(
course
)
self
.
assertEqual
(
num_drafts
,
1
)
def
test_static_tab_reordering
(
self
):
import_from_xml
(
modulestore
(),
'common/test/data/'
,
[
'full'
])
...
...
cms/envs/test.py
View file @
197f5253
...
...
@@ -58,6 +58,10 @@ MODULESTORE = {
'direct'
:
{
'ENGINE'
:
'xmodule.modulestore.mongo.MongoModuleStore'
,
'OPTIONS'
:
modulestore_options
},
'draft'
:
{
'ENGINE'
:
'xmodule.modulestore.mongo.DraftMongoModuleStore'
,
'OPTIONS'
:
modulestore_options
}
}
...
...
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