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
f005b70f
Commit
f005b70f
authored
Jan 19, 2013
by
Victor Shnayder
Committed by
Victor Shnayder
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor test cleanups
parent
fa17913a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
common/lib/xmodule/xmodule/tests/test_import.py
+15
-17
No files found.
common/lib/xmodule/xmodule/tests/test_import.py
View file @
f005b70f
...
...
@@ -52,6 +52,16 @@ class ImportTestCase(unittest.TestCase):
'''Get a dummy system'''
return
DummySystem
(
load_error_modules
)
def
get_course
(
self
,
name
):
"""Get a test course by directory name. If there's more than one, error."""
print
"Importing {0}"
.
format
(
name
)
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
name
])
courses
=
modulestore
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
return
courses
[
0
]
def
test_fallback
(
self
):
'''Check that malformed xml loads as an ErrorDescriptor.'''
...
...
@@ -207,11 +217,7 @@ class ImportTestCase(unittest.TestCase):
"""Make sure that metadata is inherited properly"""
print
"Starting import"
initial_import
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'toy'
])
courses
=
initial_import
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
course
=
courses
[
0
]
course
=
self
.
get_course
(
'toy'
)
def
check_for_key
(
key
,
node
):
"recursive check for presence of key"
...
...
@@ -227,16 +233,8 @@ class ImportTestCase(unittest.TestCase):
"""Make sure that when two courses share content with the same
org and course names, policy applies to the right one."""
def
get_course
(
name
):
print
"Importing {0}"
.
format
(
name
)
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
name
])
courses
=
modulestore
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
return
courses
[
0
]
toy
=
get_course
(
'toy'
)
two_toys
=
get_course
(
'two_toys'
)
toy
=
self
.
get_course
(
'toy'
)
two_toys
=
self
.
get_course
(
'two_toys'
)
self
.
assertEqual
(
toy
.
url_name
,
"2012_Fall"
)
self
.
assertEqual
(
two_toys
.
url_name
,
"TT_2012_Fall"
)
...
...
@@ -279,8 +277,8 @@ class ImportTestCase(unittest.TestCase):
"""Ensure that colons in url_names convert to file paths properly"""
print
"Starting import"
# Not using get_courses because we need the modulestore object too afterward
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'toy'
])
courses
=
modulestore
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
course
=
courses
[
0
]
...
...
@@ -317,7 +315,7 @@ class ImportTestCase(unittest.TestCase):
toy_id
=
"edX/toy/2012_Fall"
course
=
modulestore
.
get_course
s
()[
0
]
course
=
modulestore
.
get_course
(
toy_id
)
chapters
=
course
.
get_children
()
ch1
=
chapters
[
0
]
sections
=
ch1
.
get_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