Mercurial > piecrust2
view tests/test_baking_baker.py @ 990:22cf13b86cc3
cm: Upgrade Garcon tasks to the latest PyInvoke version.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 19 Nov 2017 14:29:52 -0800 |
parents | 8adc27285d93 |
children | 1857dbd4580f |
line wrap: on
line source
import time from .mockutil import get_mock_app, mock_fs, mock_fs_scope def test_bake_and_add_post(): fs = (mock_fs() .withConfig() .withPage('pages/_index.html', {'layout': 'none', 'format': 'none'}, "{% for p in pagination.posts -%}\n" "{{p.title}}\n" "{% endfor %}") .withPage('posts/2017-01-01_first.html', {'title': "First"}, "something")) with mock_fs_scope(fs): fs.runChef('bake') structure = fs.getStructure('kitchen/_counter') assert structure['index.html'] == 'First\n' time.sleep(1) fs.withPage('posts/2017-01-02_second.html', {'title': "Second"}, "something else") fs.runChef('bake') structure = fs.getStructure('kitchen/_counter') assert structure['index.html'] == 'Second\nFirst\n'