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
9e22bcde
Commit
9e22bcde
authored
Jul 02, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a function to check round-trip export/import cycles
parent
9471214e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
common/lib/xmodule/tests/test_export.py
+28
-0
No files found.
common/lib/xmodule/tests/test_export.py
0 → 100644
View file @
9e22bcde
from
xmodule.modulestore.xml
import
XMLModuleStore
from
nose.tools
import
assert_equals
from
tempfile
import
mkdtemp
from
fs.osfs
import
OSFS
def
check_export_roundtrip
(
data_dir
):
print
"Starting import"
initial_import
=
XMLModuleStore
(
'org'
,
'course'
,
data_dir
,
eager
=
True
)
initial_course
=
initial_import
.
course
print
"Starting export"
export_dir
=
mkdtemp
()
fs
=
OSFS
(
export_dir
)
xml
=
initial_course
.
export_to_xml
(
fs
)
with
fs
.
open
(
'course.xml'
,
'w'
)
as
course_xml
:
course_xml
.
write
(
xml
)
print
"Starting second import"
second_import
=
XMLModuleStore
(
'org'
,
'course'
,
export_dir
,
eager
=
True
)
print
"Checking key equality"
assert_equals
(
initial_import
.
modules
.
keys
(),
second_import
.
modules
.
keys
())
print
"Checking module equality"
for
location
in
initial_import
.
modules
.
keys
():
print
"Checking"
,
location
assert_equals
(
initial_import
.
modules
[
location
],
second_import
.
modules
[
location
])
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