tests.support: Use kwargs overrides in get_settings()

This avoids harcoding test-specific overrides, and makes it easy to
setup a settings dictionary based on DEFAULT_CONFIG for testing.
Because you can trust Pelican to use settings based on DEFAULT_CONFIG,
you are free to go about using:

  settings[my_key]

instead of:

  settings.get(my_key, some_fallback)

or:

  if my_key in settings:
      ...

if you know that `my_key` is in DEFAULT_CONFIG.
This commit is contained in:
W. Trevor King 2013-03-24 15:08:33 -04:00
commit c8e7d95b34
4 changed files with 66 additions and 68 deletions

View file

@ -29,7 +29,7 @@ class TestArticlesGenerator(unittest.TestCase):
for each test.
"""
if self.generator is None:
settings = get_settings()
settings = get_settings(filenames={})
settings['ARTICLE_DIR'] = 'content'
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 1, 1)
@ -144,7 +144,7 @@ class TestArticlesGenerator(unittest.TestCase):
def test_direct_templates_save_as_default(self):
settings = get_settings()
settings = get_settings(filenames={})
generator = ArticlesGenerator(settings, settings, None,
settings['THEME'], None,
settings['MARKUP'])
@ -212,7 +212,7 @@ class TestPageGenerator(unittest.TestCase):
return distilled
def test_generate_context(self):
settings = get_settings()
settings = get_settings(filenames={})
settings['PAGE_DIR'] = 'TestPages'
settings['DEFAULT_DATE'] = (1970, 1, 1)