refactoring so that command line options override settings

and Pelican class now accepts a single parameter ``settings``
This commit is contained in:
Bruno Binet 2012-10-16 01:35:35 +02:00
commit 4029f2ec82
4 changed files with 80 additions and 63 deletions

View file

@ -56,16 +56,19 @@ class TestSettingsConfiguration(unittest.TestCase):
def test_configure_settings(self):
"""Manipulations to settings should be applied correctly."""
# SITEURL should not have a trailing slash
settings = {'SITEURL': 'http://blog.notmyidea.org/', 'LOCALE': ''}
settings = {
'SITEURL': 'http://blog.notmyidea.org/',
'LOCALE': '',
'PATH': '.',
'THEME': DEFAULT_THEME,
}
configure_settings(settings)
# SITEURL should not have a trailing slash
self.assertEqual(settings['SITEURL'], 'http://blog.notmyidea.org')
# FEED_DOMAIN, if undefined, should default to SITEURL
settings = {'SITEURL': 'http://blog.notmyidea.org', 'LOCALE': ''}
configure_settings(settings)
self.assertEqual(settings['FEED_DOMAIN'], 'http://blog.notmyidea.org')
settings = {'FEED_DOMAIN': 'http://feeds.example.com', 'LOCALE': ''}
settings['FEED_DOMAIN'] = 'http://feeds.example.com'
configure_settings(settings)
self.assertEqual(settings['FEED_DOMAIN'], 'http://feeds.example.com')