Mercurial > piecrust2
diff tests/test_serving.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 | f987b29d6fab |
children | 606f6d57b5df |
line wrap: on
line diff
--- a/tests/test_serving.py Thu May 26 19:46:28 2016 -0700 +++ b/tests/test_serving.py Thu May 26 19:52:47 2016 -0700 @@ -76,12 +76,13 @@ with mock_fs_scope(fs): app = fs.getApp() page = app.getSource('pages').getPage({'slug': '_tag', 'tag': tag}) - route = app.getTaxonomyRoute('tags', 'posts') + route = app.getGeneratorRoute('posts_tags') + assert route is not None + route_metadata = {'slug': '_tag', 'tag': tag} - qp = QualifiedPage(page, route, route_metadata) ctx = PageRenderingContext(qp) - ctx.setTaxonomyFilter(tag) + route.generator.prepareRenderContext(ctx) rp = render_page(ctx) expected = "Pages in %s\n" % tag @@ -109,7 +110,13 @@ return c fs = (mock_fs() - .withConfig() + .withConfig({ + 'site': { + 'taxonomies': { + 'categories': {'term': 'category'} + } + } + }) .withPages(6, 'posts/2015-03-{idx1:02}_post{idx1:02}.md', config_factory) .withPage('pages/_category.md', {'layout': 'none', 'format': 'none'}, @@ -121,12 +128,13 @@ app = fs.getApp() page = app.getSource('pages').getPage({'slug': '_category', 'category': category}) - route = app.getTaxonomyRoute('categories', 'posts') + route = app.getGeneratorRoute('posts_categories') + assert route is not None + route_metadata = {'slug': '_category', 'category': category} - qp = QualifiedPage(page, route, route_metadata) ctx = PageRenderingContext(qp) - ctx.setTaxonomyFilter(category) + route.generator.prepareRenderContext(ctx) rp = render_page(ctx) expected = "Pages in %s\n" % category