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
8e0189bc
Commit
8e0189bc
authored
Jul 16, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip DraftVersioningModuleStore tests
parent
7a55f120
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
+19
-3
common/lib/xmodule/xmodule/tests/__init__.py
+13
-1
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
View file @
8e0189bc
...
...
@@ -16,8 +16,7 @@ import ddt
import
itertools
import
random
from
contextlib
import
contextmanager
,
nested
from
functools
import
partial
from
unittest
import
TestCase
from
unittest
import
SkipTest
from
shutil
import
rmtree
from
tempfile
import
mkdtemp
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
...
...
@@ -46,9 +45,23 @@ class MemoryCache(object):
self
.
_data
=
{}
def
get
(
self
,
key
,
default
=
None
):
"""
Get a key from the cache.
Args:
key: The key to update.
default: The value to return if the key hasn't been set previously.
"""
return
self
.
_data
.
get
(
key
,
default
)
def
set
(
self
,
key
,
value
):
"""
Set a key in the cache.
Args:
key: The key to update.
value: The value change the key to.
"""
self
.
_data
[
key
]
=
value
...
...
@@ -113,6 +126,8 @@ class VersioningModulestoreBuilder(object):
contentstore: The contentstore that this modulestore should use to store
all of its assets.
"""
# pylint: disable=unreachable
raise
SkipTest
(
"DraftVersioningModuleStore doesn't yet support the same interface as the rest of the modulestores"
)
doc_store_config
=
dict
(
db
=
'modulestore{}'
.
format
(
random
.
randint
(
0
,
10000
)),
collection
=
'split_module'
,
...
...
@@ -142,6 +157,7 @@ class VersioningModulestoreBuilder(object):
def
__repr__
(
self
):
return
'SplitModulestoreBuilder()'
class
MixedModulestoreBuilder
(
object
):
"""
A builder class for a MixedModuleStore.
...
...
@@ -221,6 +237,7 @@ MODULESTORE_SETUPS = (
CONTENTSTORE_SETUPS
=
(
MongoContentstoreBuilder
(),)
COURSE_DATA_NAMES
=
(
'toy'
,
'test_unicode'
)
@ddt.ddt
class
CrossStoreXMLRoundtrip
(
CourseComparisonTest
):
"""
...
...
@@ -242,7 +259,6 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest):
))
@ddt.unpack
def
test_round_trip
(
self
,
source_builder
,
dest_builder
,
source_content_builder
,
dest_content_builder
,
course_data_name
):
self
.
maxDiff
=
None
source_course_key
=
SlashSeparatedCourseKey
(
'source'
,
'course'
,
'key'
)
dest_course_key
=
SlashSeparatedCourseKey
(
'dest'
,
'course'
,
'key'
)
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
8e0189bc
...
...
@@ -176,6 +176,12 @@ class CourseComparisonTest(unittest.TestCase):
self
.
field_exclusions
.
add
((
usage_id
,
field_name
))
def
ignore_asset_key
(
self
,
key_name
):
"""
Add an asset key to the list of keys to be ignored when comparing assets.
Args:
key_name: The name of the key to ignore.
"""
self
.
ignored_asset_keys
.
add
(
key_name
)
def
assertCoursesEqual
(
self
,
expected_store
,
expected_course_key
,
actual_store
,
actual_course_key
):
...
...
@@ -253,6 +259,9 @@ class CourseComparisonTest(unittest.TestCase):
self
.
assertEqual
(
expected_children
,
actual_item
.
children
)
def
assertAssetEqual
(
self
,
expected_course_key
,
expected_asset
,
actual_course_key
,
actual_asset
):
"""
Assert that two assets are equal, allowing for differences related to their being from different courses.
"""
for
key
in
self
.
ignored_asset_keys
:
if
key
in
expected_asset
:
del
expected_asset
[
key
]
...
...
@@ -270,7 +279,10 @@ class CourseComparisonTest(unittest.TestCase):
self
.
assertEqual
(
actual_key
.
to_deprecated_string
(),
actual_filename
)
self
.
assertEqual
(
expected_asset
,
actual_asset
)
def
_assertAssetsEqual
(
self
,
expected_course_key
,
expected_assets
,
actual_course_key
,
actual_assets
):
def
_assertAssetsEqual
(
self
,
expected_course_key
,
expected_assets
,
actual_course_key
,
actual_assets
):
# pylint: disable=invalid-name
"""
Private helper method for assertAssetsEqual
"""
self
.
assertEqual
(
len
(
expected_assets
),
len
(
actual_assets
))
actual_assets_map
=
{
asset
[
'asset_key'
]:
asset
for
asset
in
actual_assets
}
...
...
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