Mercurial > piecrust2
comparison tests/test_appconfig.py @ 684:15b5181b2e42
tests: Add another app config test.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 09 Mar 2016 22:07:43 -0800 |
parents | ec384174b8b2 |
children | ab5c6a8ae90a |
comparison
equal
deleted
inserted
replaced
683:ec384174b8b2 | 684:15b5181b2e42 |
---|---|
20 values = {'site': {'title': "Whatever"}} | 20 values = {'site': {'title': "Whatever"}} |
21 config = PieCrustConfiguration(values=values) | 21 config = PieCrustConfiguration(values=values) |
22 assert config.get('site/root') == '/' | 22 assert config.get('site/root') == '/' |
23 assert config.get('site/title') == 'Whatever' | 23 assert config.get('site/title') == 'Whatever' |
24 | 24 |
25 | |
26 def test_config_override_default_model_settings(): | |
27 config = {'site': { | |
28 'default_page_layout': 'foo', | |
29 'default_post_layout': 'bar', | |
30 'posts_per_page': 2}} | |
31 fs = mock_fs().withConfig(config) | |
32 with mock_fs_scope(fs): | |
33 app = fs.getApp() | |
34 assert app.config.get('site/default_page_layout') == 'foo' | |
35 assert app.config.get('site/default_post_layout') == 'bar' | |
36 assert app.config.get('site/sources')['pages']['default_layout'] == 'foo' | |
37 assert app.config.get('site/sources')['pages']['items_per_page'] == 5 | |
38 assert app.config.get('site/sources')['theme_pages']['default_layout'] == 'default' | |
39 assert app.config.get('site/sources')['theme_pages']['items_per_page'] == 5 | |
40 assert app.config.get('site/sources')['posts']['default_layout'] == 'bar' | |
41 assert app.config.get('site/sources')['posts']['items_per_page'] == 2 | |
25 | 42 |
26 def test_config_site_add_source(): | 43 def test_config_site_add_source(): |
27 config = {'site': { | 44 config = {'site': { |
28 'sources': {'notes': {}}, | 45 'sources': {'notes': {}}, |
29 'routes': [{'url': '/notes/%path:slug%', 'source': 'notes'}] | 46 'routes': [{'url': '/notes/%path:slug%', 'source': 'notes'}] |