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
481eac7f
Commit
481eac7f
authored
Aug 08, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address PR feedback
parent
7b4388ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
cms/djangoapps/contentstore/tests/test_contentstore.py
+7
-8
common/lib/xmodule/xmodule/modulestore/store_utilities.py
+6
-5
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
481eac7f
...
...
@@ -627,8 +627,8 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
# get a vertical (and components in it) to put into 'draft'
# this is to assert that draft content is also cloned over
vertical
=
module_store
.
get_i
tem
(
Location
([
'i4x'
,
'edX'
,
'toy'
,
'vertical'
,
'vertical_test'
,
None
]),
depth
=
1
)
vertical
=
module_store
.
get_i
nstance
(
source_course_id
,
Location
([
source_location
.
tag
,
source_location
.
org
,
source_location
.
course
,
'vertical'
,
'vertical_test'
,
None
]),
depth
=
1
)
draft_store
.
convert_to_draft
(
vertical
.
location
)
for
child
in
vertical
.
get_children
():
...
...
@@ -649,24 +649,23 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
# first assert that all draft content got cloned as well
items
=
module_store
.
get_items
(
Location
([
source_location
.
tag
,
source_location
.
org
,
source_location
.
course
,
None
,
None
,
'draft'
]))
self
.
assertGreater
(
len
(
items
),
0
)
clone_items
=
module_store
.
get_items
(
Location
([
source_location
.
tag
,
source_location
.
org
,
source
_location
.
course
,
None
,
None
,
'draft'
]))
clone_items
=
module_store
.
get_items
(
Location
([
dest_location
.
tag
,
dest_location
.
org
,
dest
_location
.
course
,
None
,
None
,
'draft'
]))
self
.
assertGreater
(
len
(
clone_items
),
0
)
self
.
assertEqual
(
len
(
items
),
len
(
clone_items
))
# now loop through all the units in the course and verify that the clone can render them, which
# means the objects are at least present
items
=
module_store
.
get_items
(
Location
([
'i4x'
,
'edX'
,
'toy'
,
None
,
None
]))
items
=
module_store
.
get_items
(
Location
([
source_location
.
tag
,
source_location
.
org
,
source_location
.
course
,
None
,
None
]))
self
.
assertGreater
(
len
(
items
),
0
)
clone_items
=
module_store
.
get_items
(
Location
([
'i4x'
,
'MITx'
,
'999'
,
None
,
None
]))
clone_items
=
module_store
.
get_items
(
Location
([
dest_location
.
tag
,
dest_location
.
org
,
dest_location
.
course
,
None
,
None
]))
self
.
assertGreater
(
len
(
clone_items
),
0
)
#self.assertEqual(len(items), len(clone_items))
for
descriptor
in
items
:
source_item
=
module_store
.
get_instance
(
source_course_id
,
descriptor
.
location
)
if
descriptor
.
location
.
category
==
'course'
:
new_loc
=
descriptor
.
location
.
replace
(
org
=
'MITx'
,
course
=
'999'
,
name
=
'2013_Spring'
)
new_loc
=
descriptor
.
location
.
replace
(
org
=
dest_location
.
org
,
course
=
dest_location
.
course
,
name
=
'2013_Spring'
)
else
:
new_loc
=
descriptor
.
location
.
replace
(
org
=
'MITx'
,
course
=
'999'
)
new_loc
=
descriptor
.
location
.
replace
(
org
=
dest_location
.
org
,
course
=
dest_location
.
course
)
print
"Checking {0} should now also be at {1}"
.
format
(
descriptor
.
location
.
url
(),
new_loc
.
url
())
lookup_item
=
module_store
.
get_item
(
new_loc
)
...
...
common/lib/xmodule/xmodule/modulestore/store_utilities.py
View file @
481eac7f
...
...
@@ -11,16 +11,17 @@ def _clone_modules(modulestore, modules, dest_location):
original_loc
=
Location
(
module
.
location
)
if
original_loc
.
category
!=
'course'
:
module
.
location
=
module
.
location
.
_replace
(
tag
=
dest_location
.
tag
,
org
=
dest_location
.
org
,
course
=
dest_location
.
course
)
module
.
location
=
module
.
location
.
_replace
(
tag
=
dest_location
.
tag
,
org
=
dest_location
.
org
,
course
=
dest_location
.
course
)
else
:
# on the course module we also have to update the module name
module
.
location
=
module
.
location
.
_replace
(
tag
=
dest_location
.
tag
,
org
=
dest_location
.
org
,
course
=
dest_location
.
course
,
name
=
dest_location
.
name
)
module
.
location
=
module
.
location
.
_replace
(
tag
=
dest_location
.
tag
,
org
=
dest_location
.
org
,
course
=
dest_location
.
course
,
name
=
dest_location
.
name
)
print
"Cloning module {0} to {1}...."
.
format
(
original_loc
,
module
.
location
)
modulestore
.
update_item
(
module
.
location
,
module
.
_model_data
.
_kvs
.
_data
)
# NOTE: usage of the the internal module.xblock_kvs._data does not include any 'default' values for the fields
modulestore
.
update_item
(
module
.
location
,
module
.
xblock_kvs
.
_data
)
# repoint children
if
module
.
has_children
:
...
...
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