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
71ac8441
Commit
71ac8441
authored
Mar 04, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for get_orphans
parent
e972b230
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
common/lib/xmodule/xmodule/modulestore/mixed.py
+4
-0
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+16
-1
No files found.
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
71ac8441
...
...
@@ -334,6 +334,10 @@ class MixedModuleStore(ModuleStoreWriteBase):
# convert parent loc if it's legit
if
isinstance
(
course_or_parent_loc
,
basestring
):
parent_loc
=
None
if
location
is
None
:
loc_dict
=
Location
.
parse_course_id
(
course_id
)
loc_dict
[
'name'
]
=
block_id
location
=
Location
(
category
=
category
,
**
loc_dict
)
else
:
parent_loc
=
course_or_parent_loc
# must have a legitimate location, compute if appropriate
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
71ac8441
...
...
@@ -317,7 +317,6 @@ class TestMixedModuleStore(LocMapperSetupSansDjango):
self
.
assertIsNotNone
(
course
)
self
.
assertEqual
(
course
.
location
,
course_locn
)
# pylint: disable=E1101
@ddt.data
(
'direct'
,
'split'
)
def
test_get_parent_locations
(
self
,
default_ms
):
self
.
initdb
(
default_ms
)
...
...
@@ -335,6 +334,22 @@ class TestMixedModuleStore(LocMapperSetupSansDjango):
self
.
assertEqual
(
len
(
parents
),
1
)
self
.
assertEqual
(
parents
[
0
],
self
.
course_locations
[
self
.
XML_COURSEID1
])
@ddt.data
(
'direct'
,
'split'
)
def
test_get_orphans
(
self
,
default_ms
):
self
.
initdb
(
default_ms
)
# create an orphan
if
default_ms
==
'split'
:
course_id
=
self
.
course_locations
[
self
.
MONGO_COURSEID
]
.
as_course_locator
()
branch
=
course_id
.
branch
else
:
course_id
=
self
.
MONGO_COURSEID
branch
=
None
orphan
=
self
.
store
.
create_item
(
course_id
,
'problem'
,
block_id
=
'orphan'
)
found_orphans
=
self
.
store
.
get_orphans
(
self
.
course_locations
[
self
.
MONGO_COURSEID
],
branch
)
if
default_ms
==
'split'
:
self
.
assertEqual
(
found_orphans
,
[
orphan
.
location
.
version_agnostic
()])
else
:
self
.
assertEqual
(
found_orphans
,
[
unicode
(
orphan
.
location
)])
#=============================================================================================================
# General utils for not using django settings
...
...
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