mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add tests for pull request #262
This commit is contained in:
parent
8819d02600
commit
1623394da8
3 changed files with 56 additions and 17 deletions
|
|
@ -5,12 +5,13 @@ except ImportError, e:
|
|||
|
||||
from os.path import dirname, abspath, join
|
||||
|
||||
from pelican.settings import read_settings, _DEFAULT_CONFIG
|
||||
from pelican.settings import read_settings, configure_settings, _DEFAULT_CONFIG
|
||||
|
||||
|
||||
class TestSettingsFromFile(unittest2.TestCase):
|
||||
"""Providing a file, it should read it, replace the default values and
|
||||
append new values to the settings, if any
|
||||
class TestSettingsConfiguration(unittest2.TestCase):
|
||||
"""Provided a file, it should read it, replace the default values,
|
||||
append new values to the settings (if any), and apply basic settings
|
||||
optimizations.
|
||||
"""
|
||||
def setUp(self):
|
||||
self.PATH = abspath(dirname(__file__))
|
||||
|
|
@ -35,3 +36,15 @@ class TestSettingsFromFile(unittest2.TestCase):
|
|||
"""providing no file should return the default values."""
|
||||
settings = read_settings(None)
|
||||
self.assertDictEqual(settings, _DEFAULT_CONFIG)
|
||||
|
||||
def test_configure_settings(self):
|
||||
"""Manipulations to settings should be applied correctly."""
|
||||
|
||||
# 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': ''}
|
||||
configure_settings(settings)
|
||||
self.assertEqual(settings['FEED_DOMAIN'], 'http://feeds.example.com')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue