Mercurial > piecrust2
comparison tests/test_data_assetor.py @ 33:62c7a97c8340
Get the un-paginated URL of a page early and pass that around.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 19 Aug 2014 15:36:28 -0700 |
parents | 43091c9837bf |
children | 485682a6de50 |
comparison
equal
deleted
inserted
replaced
32:43091c9837bf | 33:62c7a97c8340 |
---|---|
56 assetor['one'] | 56 assetor['one'] |
57 | 57 |
58 | 58 |
59 @pytest.mark.parametrize('url_format, pretty_urls, uri, expected', [ | 59 @pytest.mark.parametrize('url_format, pretty_urls, uri, expected', [ |
60 ('%uri%', True, '/foo', '/foo/'), | 60 ('%uri%', True, '/foo', '/foo/'), |
61 ('%uri%', True, '/foo/2', '/foo/'), | |
62 ('%uri%', True, '/foo.ext', '/foo.ext/'), | 61 ('%uri%', True, '/foo.ext', '/foo.ext/'), |
63 ('%uri%', True, '/foo.ext/2', '/foo.ext/'), | |
64 ('%uri%', False, '/foo.html', '/foo/'), | 62 ('%uri%', False, '/foo.html', '/foo/'), |
65 ('%uri%', False, '/foo/2.html', '/foo/'), | 63 ('%uri%', False, '/foo.ext', '/foo/'), |
66 ]) | 64 ]) |
67 def test_build_base_url(url_format, pretty_urls, uri, expected): | 65 def test_build_base_url(url_format, pretty_urls, uri, expected): |
68 app = MagicMock() | 66 app = MagicMock() |
69 app.env = MagicMock() | 67 app.env = MagicMock() |
70 app.env.base_asset_url_format = url_format | 68 app.env.base_asset_url_format = url_format |
71 app.config = { | 69 app.config = { |
72 'site/pretty_urls': pretty_urls, | 70 'site/pretty_urls': pretty_urls} |
73 '__cache/pagination_suffix_re': '/(?P<num>\\d+)$'} | |
74 assets_path = 'foo/bar-assets' | 71 assets_path = 'foo/bar-assets' |
75 actual = build_base_url(app, uri, assets_path) | 72 actual = build_base_url(app, uri, assets_path) |
76 assert actual == expected | 73 assert actual == expected |
77 | 74 |