from unittest import TestCase, skip

import ddt
import six
from django.test import TestCase  # lint-amnesty, pylint: disable=reimported

from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.modulestore.tests.utils import (TEST_DATA_DIR, MemoryCache,
                                             MixedModulestoreBuilder,
                                             MongoModulestoreBuilder,
                                             VersioningModulestoreBuilder)
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml

MIXED_OLD_MONGO_MODULESTORE_BUILDER = MixedModulestoreBuilder([
    ('draft', MongoModulestoreBuilder())
])
MIXED_SPLIT_MODULESTORE_BUILDER = MixedModulestoreBuilder([
    ('split', VersioningModulestoreBuilder())
])


@ddt.ddt
@skip("Fix call counts below - sometimes the counts are off by 1.")
class CountMongoCallsXMLRoundtrip(TestCase):
    """
    This class exists to test XML import and export to/from Split.
    """
    def setUp(self):
        super(CountMongoCallsXMLRoundtrip, self).setUp()  # lint-amnesty, pylint: disable=super-with-arguments
        self.export_dir = mkdtemp()
class TestMongoDirectOnlyCategorySemantics(DirectOnlyCategorySemantics):
    """
    Verify DIRECT_ONLY_CATEGORY semantics against the MongoModulestore
    """
    MODULESTORE = MongoModulestoreBuilder()
    __test__ = True
Esempio n. 3
0
import ddt
import six
from django.test import TestCase

from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.modulestore.tests.utils import (
    TEST_DATA_DIR,
    MemoryCache,
    MixedModulestoreBuilder,
    MongoModulestoreBuilder,
    VersioningModulestoreBuilder
)
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml

MIXED_OLD_MONGO_MODULESTORE_BUILDER = MixedModulestoreBuilder([('draft', MongoModulestoreBuilder())])
MIXED_SPLIT_MODULESTORE_BUILDER = MixedModulestoreBuilder([('split', VersioningModulestoreBuilder())])


@ddt.ddt
@skip("Fix call counts below - sometimes the counts are off by 1.")
class CountMongoCallsXMLRoundtrip(TestCase):
    """
    This class exists to test XML import and export to/from Split.
    """

    def setUp(self):
        super(CountMongoCallsXMLRoundtrip, self).setUp()
        self.export_dir = mkdtemp()
        self.addCleanup(rmtree, self.export_dir, ignore_errors=True)