From d01614495fed0674d9c3745dc1bb76c3f98aff34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 10 Nov 2018 23:30:27 +0100 Subject: [PATCH] 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' --- pelican/tests/test_settings.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pelican/tests/test_settings.py b/pelican/tests/test_settings.py index 5e794dc5..bb05e2ae 100644 --- a/pelican/tests/test_settings.py +++ b/pelican/tests/test_settings.py @@ -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']