MIT CCX: Use CCX Keys: further revisions in response to code review
only require ccx-keys once get_current_ccx will now expect a CourseKey instance as its argument, and will raise a value error if this expectation is not met. document reason for local import add special methods to pass attribute setting and deletion through to the wrapped modulestore add __setattr__ and __delattr__ per code review, update __init__ to work with new methods style change per code review clean up context manager usage as recommended by code review remove unused code and imports convert modulestore type tests to use the `get_modulestore_type` api, remove unused imports code quality: add docstrings increase coverage for utils tests fix bug found in testing. increase test coverage on modulestore wrapper code quality fixes code-quality: ignore import error, but mark site for future consideration
This commit is contained in:
@@ -32,8 +32,6 @@ from student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
|
||||
from xmodule.modulestore.xml import XMLModuleStore
|
||||
from ccx.modulestore import CCXModulestoreWrapper
|
||||
|
||||
|
||||
TEST_MONGODB_LOG = {
|
||||
@@ -316,12 +314,9 @@ class TestSysadmin(SysadminBaseTestCase):
|
||||
# Create git loaded course
|
||||
response = self._add_edx4edx()
|
||||
|
||||
def_ms = check_ms = modulestore()
|
||||
# if the modulestore is wrapped by CCX, unwrap it for testing purposes
|
||||
if isinstance(check_ms, CCXModulestoreWrapper):
|
||||
check_ms = check_ms._modulestore
|
||||
def_ms = modulestore()
|
||||
|
||||
self.assertIn('xml', str(check_ms.__class__))
|
||||
self.assertEqual('xml', def_ms.get_modulestore_type(None))
|
||||
course = def_ms.courses.get('{0}/edx4edx_lite'.format(
|
||||
os.path.abspath(settings.DATA_DIR)), None)
|
||||
self.assertIsNotNone(course)
|
||||
@@ -465,7 +460,7 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
|
||||
self._mkdir(getattr(settings, 'GIT_REPO_DIR'))
|
||||
|
||||
def_ms = modulestore()
|
||||
self.assertFalse(isinstance(def_ms, XMLModuleStore))
|
||||
self.assertFalse('xml' == def_ms.get_modulestore_type(None))
|
||||
|
||||
self._add_edx4edx()
|
||||
course = def_ms.get_course(SlashSeparatedCourseKey('MITx', 'edx4edx', 'edx4edx'))
|
||||
|
||||
Reference in New Issue
Block a user