Add make_course_key to modulestores, so that external clients don't need to assume a CourseKey subtype.
Conflicts: common/lib/xmodule/xmodule/modulestore/xml_importer.py
This commit is contained in:
committed by
Don Mitchell
parent
84992cdfa5
commit
b87d469c89
@@ -170,6 +170,15 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
|
||||
# return the default store
|
||||
return self.default_modulestore
|
||||
# return the first store, as the default
|
||||
return self.default_modulestore
|
||||
|
||||
@property
|
||||
def default_modulestore(self):
|
||||
"""
|
||||
Return the default modulestore
|
||||
"""
|
||||
return self.modulestores[0]
|
||||
|
||||
def _get_modulestore_by_type(self, modulestore_type):
|
||||
"""
|
||||
|
||||
@@ -235,7 +235,10 @@ MODULESTORE_SETUPS = (
|
||||
MixedModulestoreBuilder([('split', VersioningModulestoreBuilder())]),
|
||||
)
|
||||
CONTENTSTORE_SETUPS = (MongoContentstoreBuilder(),)
|
||||
COURSE_DATA_NAMES = ('toy', 'manual-testing-complete')
|
||||
COURSE_DATA_NAMES = (
|
||||
'toy',
|
||||
'manual-testing-complete',
|
||||
)
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -259,8 +262,6 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest):
|
||||
))
|
||||
@ddt.unpack
|
||||
def test_round_trip(self, source_builder, dest_builder, source_content_builder, dest_content_builder, course_data_name):
|
||||
source_course_key = SlashSeparatedCourseKey('source', 'course', 'key')
|
||||
dest_course_key = SlashSeparatedCourseKey('dest', 'course', 'key')
|
||||
|
||||
# Construct the contentstore for storing the first import
|
||||
with source_content_builder.build() as source_content:
|
||||
@@ -270,6 +271,9 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest):
|
||||
with dest_content_builder.build() as dest_content:
|
||||
# Construct the modulestore for storing the second import (using the second contentstore)
|
||||
with dest_builder.build(dest_content) as dest_store:
|
||||
source_course_key = source_store.make_course_key('source', 'course', 'key')
|
||||
dest_course_key = dest_store.make_course_key('dest', 'course', 'key')
|
||||
|
||||
import_from_xml(
|
||||
source_store,
|
||||
'test_user',
|
||||
|
||||
@@ -168,7 +168,7 @@ def import_from_xml(
|
||||
if target_course_id is not None:
|
||||
dest_course_id = target_course_id
|
||||
else:
|
||||
dest_course_id = course_key
|
||||
dest_course_id = store.make_course_key(course_key.org, course_key.course, course_key.run)
|
||||
|
||||
# Creates a new course if it doesn't already exist
|
||||
if create_new_course_if_not_present and not store.has_course(dest_course_id, ignore_case=True):
|
||||
|
||||
Reference in New Issue
Block a user