Commit 53f7c507 by Don Mitchell

Added test for defaulting use_locations

parent c601b756
......@@ -36,7 +36,7 @@ class MixedModuleStore(ModuleStoreWriteBase):
self.mappings = mappings
# temporary code for transition period
if reference_type is None:
log.warn("reference_type not specified in MixedModuleStore settings.",
log.warn("reference_type not specified in MixedModuleStore settings. %s",
"Will default temporarily to the to-be-deprecated Location.")
self.use_locations = (reference_type != 'Locator')
if 'default' not in stores:
......
......@@ -13,6 +13,8 @@ from xmodule.modulestore.xml_importer import import_from_xml
# Mixed modulestore depends on django, so we'll manually configure some django settings
# before importing the module
from django.conf import settings
import unittest
import copy
if not settings.configured:
settings.configure()
......@@ -245,3 +247,25 @@ class TestMixedModuleStore(object):
assert_equals(Location(parents[0]).org, 'edX')
assert_equals(Location(parents[0]).course, 'toy')
assert_equals(Location(parents[0]).name, '2012_Fall')
class TestMixedMSInit(unittest.TestCase):
"""
Test initializing w/o a reference_type
"""
def setUp(self):
unittest.TestCase.setUp(self)
options = copy.copy(OPTIONS)
del options['reference_type']
self.connection = pymongo.MongoClient(
host=HOST,
port=PORT,
tz_aware=True,
)
self.store = MixedModuleStore(**options)
def test_use_locations(self):
"""
Test that use_locations defaulted correctly
"""
self.assertTrue(self.store.use_locations)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment