comparison tests/test_appconfig.py @ 711:ab5c6a8ae90a

bake: Replace hard-coded taxonomy support with "generator" system. * Taxonomies are now implemented one or more `TaxonomyGenerator`s. * A `BlogArchivesGenerator` stub is there but non-functional.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 26 May 2016 19:52:47 -0700
parents 15b5181b2e42
children fd694f1297c7
comparison
equal deleted inserted replaced
710:e85f29b28b84 711:ab5c6a8ae90a
47 }} 47 }}
48 fs = mock_fs().withConfig(config) 48 fs = mock_fs().withConfig(config)
49 with mock_fs_scope(fs): 49 with mock_fs_scope(fs):
50 app = fs.getApp() 50 app = fs.getApp()
51 # The order of routes is important. Sources, not so much. 51 # The order of routes is important. Sources, not so much.
52 # `posts` shows up 3 times in routes (posts, tags, categories)
53 assert (list( 52 assert (list(
54 map( 53 map(
55 lambda v: v['source'], 54 lambda v: v.get('generator') or v['source'],
56 app.config.get('site/routes'))) == 55 app.config.get('site/routes'))) ==
57 ['notes', 'posts', 'posts', 'posts', 'pages', 'theme_pages']) 56 ['notes', 'posts', 'posts_archives', 'posts_tags', 'posts_categories', 'pages', 'theme_pages'])
58 assert list(app.config.get('site/sources').keys()) == [ 57 assert list(app.config.get('site/sources').keys()) == [
59 'theme_pages', 'pages', 'posts', 'notes'] 58 'theme_pages', 'pages', 'posts', 'notes']
60 59
61 60
62 def test_config_site_add_source_in_both_site_and_theme(): 61 def test_config_site_add_source_in_both_site_and_theme():
75 app = fs.getApp() 74 app = fs.getApp()
76 # The order of routes is important. Sources, not so much. 75 # The order of routes is important. Sources, not so much.
77 # `posts` shows up 3 times in routes (posts, tags, categories) 76 # `posts` shows up 3 times in routes (posts, tags, categories)
78 assert (list( 77 assert (list(
79 map( 78 map(
80 lambda v: v['source'], 79 lambda v: v.get('generator') or v['source'],
81 app.config.get('site/routes'))) == 80 app.config.get('site/routes'))) ==
82 ['notes', 'posts', 'posts', 'posts', 'pages', 'theme_notes', 'theme_pages']) 81 ['notes', 'posts', 'posts_archives', 'posts_tags', 'posts_categories', 'pages', 'theme_notes', 'theme_pages'])
83 assert list(app.config.get('site/sources').keys()) == [ 82 assert list(app.config.get('site/sources').keys()) == [
84 'theme_pages', 'theme_notes', 'pages', 'posts', 'notes'] 83 'theme_pages', 'theme_notes', 'pages', 'posts', 'notes']
85 84