Merge pull request #11660 from edx/hassan/dump-course-ids-fix
Include CCX courses in dump_course_ids.
This commit is contained in:
@@ -6,6 +6,7 @@ from textwrap import dedent
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -24,17 +25,6 @@ class Command(BaseCommand):
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
store = modulestore()
|
||||
name = options['modulestore']
|
||||
if name != 'default':
|
||||
# since a store type is given, get that specific store
|
||||
if hasattr(store, '_get_modulestore_by_type'):
|
||||
store = store._get_modulestore_by_type(name)
|
||||
if store.get_modulestore_type() != name:
|
||||
raise CommandError("Modulestore {} not found".format(name))
|
||||
|
||||
if store is None:
|
||||
raise CommandError("Unknown modulestore {}".format(name))
|
||||
output = u'\n'.join(unicode(course.id) for course in store.get_courses()) + '\n'
|
||||
output = u'\n'.join(unicode(course_overview.id) for course_overview in CourseOverview.get_all_courses()) + '\n'
|
||||
|
||||
return output
|
||||
|
||||
@@ -25,14 +25,6 @@ from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
XML_COURSE_DIRS = ['toy', 'simple']
|
||||
MAPPINGS = {
|
||||
'edX/toy/2012_Fall': 'xml',
|
||||
'edX/simple/2012_Fall': 'xml',
|
||||
}
|
||||
|
||||
TEST_DATA_MIXED_XML_MODULESTORE = mixed_store_config(
|
||||
DATA_DIR, MAPPINGS, include_xml=True, xml_source_dirs=XML_COURSE_DIRS,
|
||||
)
|
||||
|
||||
|
||||
@attr('shard_1')
|
||||
@@ -59,6 +51,7 @@ class CommandsTestBase(ModuleStoreTestCase):
|
||||
# Add a course with a unicode name.
|
||||
unique_org = factory.Sequence(lambda n: u'ëḋẌ.%d' % n)
|
||||
CourseFactory.create(
|
||||
emit_signals=True,
|
||||
org=unique_org,
|
||||
course=u'śíḿṕĺé',
|
||||
display_name=u'2012_Fáĺĺ',
|
||||
@@ -82,10 +75,8 @@ class CommandsTestBase(ModuleStoreTestCase):
|
||||
return out.read()
|
||||
|
||||
def test_dump_course_ids(self):
|
||||
kwargs = {'modulestore': 'default'}
|
||||
output = self.call_command('dump_course_ids', **kwargs)
|
||||
output = self.call_command('dump_course_ids')
|
||||
dumped_courses = output.decode('utf-8').strip().split('\n')
|
||||
|
||||
course_ids = {unicode(course_id) for course_id in self.loaded_courses}
|
||||
dumped_ids = set(dumped_courses)
|
||||
self.assertEqual(course_ids, dumped_ids)
|
||||
@@ -205,15 +196,6 @@ class CommandsTestBase(ModuleStoreTestCase):
|
||||
assert_in('edX-simple-2012_Fall/sequential/Lecture_2.xml', names)
|
||||
|
||||
|
||||
class CommandsXMLTestCase(CommandsTestBase):
|
||||
"""
|
||||
Test case for management commands with the xml modulestore present.
|
||||
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MIXED_XML_MODULESTORE
|
||||
__test__ = True
|
||||
|
||||
|
||||
class CommandsMongoTestCase(CommandsTestBase):
|
||||
"""
|
||||
Test case for management commands using the mixed mongo modulestore with old mongo as the default.
|
||||
|
||||
Reference in New Issue
Block a user