Mercurial > piecrust2
diff tests/test_routing.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_routing.py Sun Oct 29 22:46:41 2017 -0700 +++ b/tests/test_routing.py Sun Oct 29 22:51:57 2017 -0700 @@ -27,25 +27,21 @@ @pytest.mark.parametrize( - 'config, metadata, params, expected', + 'config, params, uri_params, expected', [ - ({'url': '/%foo%'}, - {'foo': 'bar'}, ['foo'], True), - ({'url': '/%foo%'}, - {'zoo': 'zar', 'foo': 'bar'}, ['foo'], True), - ({'url': '/%foo%'}, - {'zoo': 'zar'}, ['foo'], False), - ({'url': '/%foo%/%zoo%'}, - {'zoo': 'zar'}, ['foo', 'zoo'], False) + ({'url': '/%foo%'}, ['foo'], {'foo': 'bar'}, True), + ({'url': '/%foo%'}, ['foo'], {'zoo': 'zar', 'foo': 'bar'}, True), + ({'url': '/%foo%'}, ['foo'], {'zoo': 'zar'}, False), + ({'url': '/%foo%/%zoo%'}, ['foo', 'zoo'], {'zoo': 'zar'}, False) ]) -def test_matches_metadata(config, metadata, params, expected): +def test_matches_parameters(config, params, uri_params, expected): app = get_mock_app() app.config.set('site/root', '/') app.sources = [_getMockSource('blah', params)] config.setdefault('source', 'blah') route = Route(app, config) - m = route.matchesMetadata(metadata) + m = route.matchesParameters(uri_params) assert m == expected