Auto enroll students even if there are multiple course modes

Add session middleware to an external auth test to fix a test failure with the auto-registration AB-test changes
This commit is contained in:
Will Daly
2014-08-13 08:28:06 -04:00
parent c12ed3ae9a
commit 714f9bb69f
8 changed files with 498 additions and 119 deletions

View File

@@ -15,36 +15,45 @@ from xmodule.tabs import CoursewareTab, CourseInfoTab, StaticTab, DiscussionTab,
from xmodule.modulestore.tests.sample_courses import default_block_info_tree, TOY_BLOCK_INFO_TREE
def mixed_store_config(data_dir, mappings):
def mixed_store_config(data_dir, mappings, include_xml=True):
"""
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:
Args:
data_dir (string): the directory from which to load XML-backed courses.
mappings (string): a dictionary mapping course IDs to modulestores, for example:
{
'MITx/2.01x/2013_Spring': 'xml',
'edx/999/2013_Spring': 'default'
}
{
'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..
Keyword Args:
include_xml (boolean): If True, include an XML modulestore in the configuration.
Note that this will require importing multiple XML courses from disk,
so unless your tests really needs XML course fixtures or is explicitly
testing mixed modulestore, set this to False.
where 'xml' and 'default' are the two options provided by this configuration,
mapping (respectively) to XML-backed and Mongo-backed modulestores..
"""
draft_mongo_config = draft_mongo_store_config(data_dir)
xml_config = xml_store_config(data_dir)
split_mongo = split_mongo_store_config(data_dir)
stores = [
draft_mongo_store_config(data_dir)['default'],
split_mongo_store_config(data_dir)['default']
]
if include_xml:
stores.append(xml_store_config(data_dir)['default'])
store = {
'default': {
'ENGINE': 'xmodule.modulestore.mixed.MixedModuleStore',
'OPTIONS': {
'mappings': mappings,
'stores': [
draft_mongo_config['default'],
split_mongo['default'],
xml_config['default'],
]
'stores': stores,
}
}
}