comparison tests/test_templating_pystacheengine.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 2537fe95d771
children 72f17534d58e
comparison
equal deleted inserted replaced
710:e85f29b28b84 711:ab5c6a8ae90a
26 .withConfig(app_config) 26 .withConfig(app_config)
27 .withPage('pages/foo', config=page_config, contents=contents)) 27 .withPage('pages/foo', config=page_config, contents=contents))
28 with mock_fs_scope(fs, open_patches=open_patches): 28 with mock_fs_scope(fs, open_patches=open_patches):
29 app = fs.getApp() 29 app = fs.getApp()
30 page = get_simple_page(app, 'foo.md') 30 page = get_simple_page(app, 'foo.md')
31 route = app.getRoute('pages', None) 31 route = app.getSourceRoute('pages', None)
32 route_metadata = {'slug': 'foo'} 32 route_metadata = {'slug': 'foo'}
33 output = render_simple_page(page, route, route_metadata) 33 output = render_simple_page(page, route, route_metadata)
34 assert output == expected 34 assert output == expected
35 35
36 36
44 .withPage('pages/foo', config={'layout': 'blah'}, 44 .withPage('pages/foo', config={'layout': 'blah'},
45 contents=contents)) 45 contents=contents))
46 with mock_fs_scope(fs, open_patches=open_patches): 46 with mock_fs_scope(fs, open_patches=open_patches):
47 app = fs.getApp() 47 app = fs.getApp()
48 page = get_simple_page(app, 'foo.md') 48 page = get_simple_page(app, 'foo.md')
49 route = app.getRoute('pages', None) 49 route = app.getSourceRoute('pages', None)
50 route_metadata = {'slug': 'foo'} 50 route_metadata = {'slug': 'foo'}
51 output = render_simple_page(page, route, route_metadata) 51 output = render_simple_page(page, route, route_metadata)
52 # On Windows, pystache unexplicably adds `\r` to some newlines... wtf. 52 # On Windows, pystache unexplicably adds `\r` to some newlines... wtf.
53 output = output.replace('\r', '') 53 output = output.replace('\r', '')
54 assert output == expected 54 assert output == expected
63 .withAsset('templates/page_info.mustache', partial) 63 .withAsset('templates/page_info.mustache', partial)
64 .withPage('pages/foo', config=page_config, contents=contents)) 64 .withPage('pages/foo', config=page_config, contents=contents))
65 with mock_fs_scope(fs, open_patches=open_patches): 65 with mock_fs_scope(fs, open_patches=open_patches):
66 app = fs.getApp() 66 app = fs.getApp()
67 page = get_simple_page(app, 'foo.md') 67 page = get_simple_page(app, 'foo.md')
68 route = app.getRoute('pages', None) 68 route = app.getSourceRoute('pages', None)
69 route_metadata = {'slug': 'foo'} 69 route_metadata = {'slug': 'foo'}
70 output = render_simple_page(page, route, route_metadata) 70 output = render_simple_page(page, route, route_metadata)
71 # On Windows, pystache unexplicably adds `\r` to some newlines... wtf. 71 # On Windows, pystache unexplicably adds `\r` to some newlines... wtf.
72 output = output.replace('\r', '') 72 output = output.replace('\r', '')
73 assert output == expected 73 assert output == expected