Mercurial > piecrust2
view tests/test_appconfig.py @ 651:cc2d212c3ba1 2.0.0b5
cm: Regenerate the CHANGELOG.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 16 Feb 2016 22:32:58 -0800 |
parents | 25df894f9ab9 |
children | 3df808b133f8 |
line wrap: on
line source
from piecrust.appconfig import PieCrustConfiguration def test_config_default(): values = {} config = PieCrustConfiguration(values=values) assert config.get('site/root') == '/' assert len(config.get('site/sources')) == 3 # pages, posts, theme_pages def test_config_default2(): config = PieCrustConfiguration() assert config.get('site/root') == '/' assert len(config.get('site/sources')) == 3 # pages, posts, theme_pages def test_config_site_override_title(): values = {'site': {'title': "Whatever"}} config = PieCrustConfiguration(values=values) assert config.get('site/root') == '/' assert config.get('site/title') == 'Whatever' def test_config_site_add_source(): values = {'site': { 'sources': {'notes': {}}, 'routes': [{'url': '/notes/%path:slug%', 'source': 'notes'}] }} config = PieCrustConfiguration(values=values) # The order of routes is important. Sources, not so much. assert list(map(lambda v: v['source'], config.get('site/routes'))) == [ 'notes', 'posts', 'posts', 'posts', 'pages', 'theme_pages'] assert list(config.get('site/sources').keys()) == [ 'pages', 'posts', 'notes', 'theme_pages']