1
0
Fork 0
forked from github/pelican

settings: test reading PAGINATED_DIRECT_TEMPLATES from pelicanconf.py.

At the moment aborts with the following:

      File "/usr/lib/python3.7/site-packages/pelican/settings.py", line 327, in handle_deprecated_settings
        if t not in settings['PAGINATED_TEMPLATES']:
    KeyError: 'PAGINATED_TEMPLATES'
This commit is contained in:
Vladimír Vondruš 2018-11-10 23:30:27 +01:00
commit d01614495f

View file

@ -187,6 +187,20 @@ class TestSettingsConfiguration(unittest.TestCase):
{'index': 10, 'category': None, 'archives': None})
self.assertNotIn('PAGINATED_DIRECT_TEMPLATES', settings)
def test_deprecated_paginated_direct_templates_from_file(self):
# This is equivalent to reading a settings file that has
# PAGINATED_DIRECT_TEMPLATES defined but no PAGINATED_TEMPLATES.
settings = read_settings(None, override={
'PAGINATED_DIRECT_TEMPLATES': ['index', 'archives']
})
self.assertEqual(settings['PAGINATED_TEMPLATES'], {
'archives': None,
'author': None,
'index': None,
'category': None,
'tag': None})
self.assertNotIn('PAGINATED_DIRECT_TEMPLATES', settings)
def test_theme_and_extra_templates_exception(self):
settings = self.settings
settings['EXTRA_TEMPLATES_PATHS'] = ['/ha']