diff tests/test_data_provider.py @ 974:72f17534d58e

tests: First pass on making unit tests work again. - Fix all imports - Add more helper functions to work with mock file-systems - Simplify some code by running chef directly on the mock FS - Fix a couple tests
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 17 Oct 2017 01:07:30 -0700
parents ab5c6a8ae90a
children
line wrap: on
line diff
--- a/tests/test_data_provider.py	Tue Oct 17 01:04:10 2017 -0700
+++ b/tests/test_data_provider.py	Tue Oct 17 01:07:30 2017 -0700
@@ -1,5 +1,5 @@
-from piecrust.rendering import QualifiedPage, PageRenderingContext, render_page
 from .mockutil import mock_fs, mock_fs_scope
+from .rdrutil import render_simple_page
 
 
 def test_blog_provider():
@@ -18,12 +18,8 @@
                     "{%endfor%}\n"))
     with mock_fs_scope(fs):
         app = fs.getApp()
-        page = app.getSource('pages').getPage({'slug': 'tags'})
-        route = app.getSourceRoute('pages', None)
-        route_metadata = {'slug': 'tags'}
-        qp = QualifiedPage(page, route, route_metadata)
-        ctx = PageRenderingContext(qp)
-        rp = render_page(ctx)
+        page = app.getSimplePage('tags.md')
+        actual = render_simple_page(page)
         expected = "\nBar (1)\n\nFoo (2)\n"
-        assert rp.content == expected
+        assert actual == expected