diff tests/test_templating_pystacheengine.py @ 979:45ad976712ec

tests: Big push to get the tests to pass again. - Lots of fixes everywhere in the code. - Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now. - Replace all `.md` test files with `.html` since now a auto-format extension always sets the format. - Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 29 Oct 2017 22:51:57 -0700
parents 72f17534d58e
children
line wrap: on
line diff
--- a/tests/test_templating_pystacheengine.py	Sun Oct 29 22:46:41 2017 -0700
+++ b/tests/test_templating_pystacheengine.py	Sun Oct 29 22:51:57 2017 -0700
@@ -26,11 +26,8 @@
           .withConfig(app_config)
           .withPage('pages/foo', config=page_config, contents=contents))
     with mock_fs_scope(fs, open_patches=open_patches):
-        app = fs.getApp()
         page = fs.getSimplePage('foo.md')
-        route = app.getSourceRoute('pages', None)
-        route_metadata = {'slug': 'foo'}
-        output = render_simple_page(page, route, route_metadata)
+        output = render_simple_page(page)
         assert output == expected
 
 
@@ -41,14 +38,11 @@
     fs = (mock_fs()
           .withConfig(app_config)
           .withAsset('templates/blah.mustache', layout)
-          .withPage('pages/foo', config={'layout': 'blah'},
+          .withPage('pages/foo', config={'layout': 'blah.mustache'},
                     contents=contents))
     with mock_fs_scope(fs, open_patches=open_patches):
-        app = fs.getApp()
         page = fs.getSimplePage('foo.md')
-        route = app.getSourceRoute('pages', None)
-        route_metadata = {'slug': 'foo'}
-        output = render_simple_page(page, route, route_metadata)
+        output = render_simple_page(page)
         # On Windows, pystache unexplicably adds `\r` to some newlines... wtf.
         output = output.replace('\r', '')
         assert output == expected
@@ -56,18 +50,15 @@
 
 def test_partial():
     contents = "Info:\n{{#page}}\n{{> page_info}}\n{{/page}}\n"
-    partial = "- URL: {{url}}\n- SLUG: {{slug}}\n"
+    partial = "- URL: {{url}}\n- SLUG: {{route.slug}}\n"
     expected = "Info:\n- URL: /foo.html\n- SLUG: foo\n"
     fs = (mock_fs()
           .withConfig(app_config)
           .withAsset('templates/page_info.mustache', partial)
           .withPage('pages/foo', config=page_config, contents=contents))
     with mock_fs_scope(fs, open_patches=open_patches):
-        app = fs.getApp()
         page = fs.getSimplePage('foo.md')
-        route = app.getSourceRoute('pages', None)
-        route_metadata = {'slug': 'foo'}
-        output = render_simple_page(page, route, route_metadata)
+        output = render_simple_page(page)
         # On Windows, pystache unexplicably adds `\r` to some newlines... wtf.
         output = output.replace('\r', '')
         assert output == expected