Commit 1a1c93e5 by John Eskew

Remove orphaned pre-startup code and tests.

parent a36eb51a
......@@ -281,17 +281,6 @@ class BaseMicrositeBackend(AbstractBaseMicrositeBackend):
microsites_root
)
def enable_microsites_pre_startup(self, log):
"""
The TEMPLATE_ENGINE directory to search for microsite templates
in non-mako templates must be loaded before the django startup
"""
microsites_root = settings.MICROSITE_ROOT_DIR
if self.has_configuration_set():
settings.MAKO_TEMPLATES['main'].insert(0, microsites_root)
settings.DEFAULT_TEMPLATE_ENGINE['DIRS'].append(microsites_root)
class BaseMicrositeTemplateBackend(object):
"""
......
......@@ -17,7 +17,7 @@ __all__ = [
'is_request_in_microsite', 'get_value', 'has_override_value',
'get_template_path', 'get_value_for_org', 'get_all_orgs',
'clear', 'set_by_domain', 'enable_microsites', 'get_all_config',
'is_feature_enabled', 'enable_microsites_pre_startup',
'is_feature_enabled',
]
BACKEND = None
......@@ -102,15 +102,6 @@ def set_by_domain(domain):
BACKEND.set_config_by_domain(domain)
def enable_microsites_pre_startup(log):
"""
Prepare the feature settings that must be enabled before django.setup() or
autostartup() during the startup script
"""
if is_feature_enabled():
BACKEND.enable_microsites_pre_startup(log)
def enable_microsites(log):
"""
Enable the use of microsites during the startup script
......
......@@ -138,36 +138,3 @@ class AbstractBaseMicrositeBackendTests(TestCase):
with self.assertRaises(NotImplementedError):
backend.get_all_orgs()
@patch(
'microsite_configuration.microsite.BACKEND',
microsite.get_backend(
'microsite_configuration.backends.base.BaseMicrositeBackend', BaseMicrositeBackend
)
)
class BaseMicrositeBackendTests(TestCase):
"""
Go through and test the BaseMicrositeBackend class for behavior which is not
overriden in subclasses
"""
def test_enable_microsites_pre_startup(self):
"""
Tests microsite.test_enable_microsites_pre_startup works as expected.
"""
# remove microsite root directory paths first
settings.DEFAULT_TEMPLATE_ENGINE['DIRS'] = [
path for path in settings.DEFAULT_TEMPLATE_ENGINE['DIRS']
if path != settings.MICROSITE_ROOT_DIR
]
with patch('microsite_configuration.backends.base.BaseMicrositeBackend.has_configuration_set',
return_value=False):
microsite.enable_microsites_pre_startup(log)
self.assertNotIn(settings.MICROSITE_ROOT_DIR,
settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
with patch('microsite_configuration.backends.base.BaseMicrositeBackend.has_configuration_set',
return_value=True):
microsite.enable_microsites_pre_startup(log)
self.assertIn(settings.MICROSITE_ROOT_DIR,
settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
......@@ -102,23 +102,6 @@ class DatabaseMicrositeBackendTests(DatabaseMicrositeTestCase):
microsite.clear()
self.assertIsNone(microsite.get_value('platform_name'))
def test_enable_microsites_pre_startup(self):
"""
Tests microsite.test_enable_microsites_pre_startup works as expected.
"""
# remove microsite root directory paths first
settings.DEFAULT_TEMPLATE_ENGINE['DIRS'] = [
path for path in settings.DEFAULT_TEMPLATE_ENGINE['DIRS']
if path != settings.MICROSITE_ROOT_DIR
]
with patch.dict('django.conf.settings.FEATURES', {'USE_MICROSITES': False}):
microsite.enable_microsites_pre_startup(log)
self.assertNotIn(settings.MICROSITE_ROOT_DIR, settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
with patch.dict('django.conf.settings.FEATURES', {'USE_MICROSITES': True}):
microsite.enable_microsites_pre_startup(log)
self.assertIn(settings.MICROSITE_ROOT_DIR, settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
self.assertIn(settings.MICROSITE_ROOT_DIR, settings.MAKO_TEMPLATES['main'])
@patch('edxmako.paths.add_lookup')
def test_enable_microsites(self, add_lookup):
"""
......
......@@ -81,20 +81,3 @@ class MicrositeTests(TestCase):
),
DatabaseMicrositeBackend
)
def test_enable_microsites_pre_startup(self):
"""
Tests microsite.test_enable_microsites_pre_startup is not used if the feature is turned off.
"""
# remove microsite root directory paths first
settings.DEFAULT_TEMPLATE_ENGINE['DIRS'] = [
path for path in settings.DEFAULT_TEMPLATE_ENGINE['DIRS']
if path != settings.MICROSITE_ROOT_DIR
]
with patch.dict('django.conf.settings.FEATURES', {'USE_MICROSITES': False}):
microsite.enable_microsites_pre_startup(log)
self.assertNotIn(settings.MICROSITE_ROOT_DIR, settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
with patch.dict('django.conf.settings.FEATURES', {'USE_MICROSITES': True}):
microsite.enable_microsites_pre_startup(log)
self.assertIn(settings.MICROSITE_ROOT_DIR, settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
......@@ -66,11 +66,3 @@ def add_mimetypes():
mimetypes.add_type('application/x-font-opentype', '.otf')
mimetypes.add_type('application/x-font-ttf', '.ttf')
mimetypes.add_type('application/font-woff', '.woff')
def enable_microsites():
"""
Calls the enable_microsites function in the microsite backend.
Here for backwards compatibility
"""
microsite.enable_microsites(log)
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