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
06977c19
Commit
06977c19
authored
Aug 19, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created new test configuration for MixedModuleStore
parent
594a73d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
7 deletions
+44
-7
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
+44
-7
No files found.
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
View file @
06977c19
import
copy
from
uuid
import
uuid4
from
django.test
import
TestCase
...
...
@@ -8,6 +7,41 @@ import xmodule.modulestore.django
from
unittest.util
import
safe_repr
def
mixed_store_config
(
data_dir
,
mappings
):
"""
Return a `MixedModuleStore` configuration, which provides
access to both Mongo- and XML-backed courses.
`data_dir` is the directory from which to load XML-backed courses.
`mappings` is a dictionary mapping course IDs to modulestores, for example:
{
'MITx/2.01x/2013_Spring': 'xml',
'edx/999/2013_Spring': 'default'
}
where 'xml' and 'default' are the two options provided by this configuration,
mapping (respectively) to XML-backed and Mongo-backed modulestores..
"""
mongo_config
=
mongo_store_config
(
data_dir
)
xml_config
=
xml_store_config
(
data_dir
)
store
=
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.mixed.MixedModuleStore'
,
'OPTIONS'
:
{
'mappings'
:
mappings
,
'stores'
:
{
'default'
:
mongo_config
[
'default'
],
'xml'
:
xml_config
[
'default'
]
}
}
}
}
store
[
'direct'
]
=
store
[
'default'
]
return
store
def
mongo_store_config
(
data_dir
):
"""
Defines default module store using MongoModuleStore.
...
...
@@ -27,6 +61,7 @@ def mongo_store_config(data_dir):
}
}
}
store
[
'direct'
]
=
store
[
'default'
]
return
store
...
...
@@ -45,23 +80,22 @@ def draft_mongo_store_config(data_dir):
'render_template'
:
'mitxmako.shortcuts.render_to_string'
}
return
{
store
=
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.mongo.draft.DraftModuleStore'
,
'OPTIONS'
:
modulestore_options
},
'direct'
:
{
'ENGINE'
:
'xmodule.modulestore.mongo.MongoModuleStore'
,
'OPTIONS'
:
modulestore_options
}
}
store
[
'direct'
]
=
store
[
'default'
]
return
store
def
xml_store_config
(
data_dir
):
"""
Defines default module store using XMLModuleStore.
"""
return
{
store
=
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.xml.XMLModuleStore'
,
'OPTIONS'
:
{
...
...
@@ -71,6 +105,9 @@ def xml_store_config(data_dir):
}
}
store
[
'direct'
]
=
store
[
'default'
]
return
store
class
ModuleStoreTestCase
(
TestCase
):
""" Subclass for any test case that uses the mongodb
...
...
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