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
9dff39dd
Commit
9dff39dd
authored
Dec 27, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start adding clone unit test
parent
fe408be1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
cms/djangoapps/contentstore/tests/tests.py
+29
-0
cms/envs/test.py
+8
-0
No files found.
cms/djangoapps/contentstore/tests/tests.py
View file @
9dff39dd
...
...
@@ -13,6 +13,10 @@ from xmodule.modulestore.xml_importer import import_from_xml
import
copy
from
factories
import
*
from
xmodule.modulestore.store_utilities
import
clone_course
from
xmodule.modulestore.store_utilities
import
delete_course
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.django
import
contentstore
def
parse_json
(
response
):
"""Parse response, which is assumed to be json"""
...
...
@@ -339,4 +343,29 @@ class ContentStoreTest(TestCase):
def
test_edit_unit_full
(
self
):
self
.
check_edit_unit
(
'full'
)
def
test_clone_course
(
self
):
import_from_xml
(
modulestore
(),
'common/test/data/'
,
[
'full'
])
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'1001'
,
display_name
=
'Clone target'
)
ms
=
modulestore
(
'direct'
)
cs
=
contentstore
()
source_location
=
CourseDescriptor
.
id_to_location
(
'edX/full/6.002_Spring_2012'
)
dest_location
=
CourseDescriptor
.
id_to_location
(
'edX/1001/Clone_target'
)
clone_course
(
ms
,
cs
,
source_location
,
dest_location
)
# 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
=
ms
.
get_items
(
Location
(
'edX'
,
'full'
,
'vertical'
,
None
,
None
))
self
.
assertGreater
(
len
(
items
),
0
)
clone_items
=
ms
.
get_items
(
Location
(
'edX'
,
'1001'
,
'Clone_target'
))
self
.
assertGreater
(
len
(
clone_items
),
0
)
for
descriptor
in
items
:
new_loc
=
descriptor
.
location
.
_update
({
'course'
:
'1001'
})
print
"Checking {0} should now also be at {1}"
.
format
(
descriptor
.
location
.
url
(),
new_loc
.
url
())
resp
=
self
.
client
.
get
(
reverse
(
'edit_unit'
,
kwargs
=
{
'location'
:
new_loc
.
url
()}))
self
.
assertEqual
(
resp
.
status_code
,
200
)
cms/envs/test.py
View file @
9dff39dd
...
...
@@ -59,6 +59,14 @@ MODULESTORE = {
}
}
CONTENTSTORE
=
{
'ENGINE'
:
'xmodule.contentstore.mongo.MongoContentStore'
,
'OPTIONS'
:
{
'host'
:
'localhost'
,
'db'
:
'xcontent'
,
}
}
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
...
...
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