Mercurial > piecrust2
comparison tests/test_uriutil.py @ 710:e85f29b28b84
internal: Remove unused piece of code.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 26 May 2016 19:46:28 -0700 |
parents | 4284c673bb91 |
children |
comparison
equal
deleted
inserted
replaced
709:4285b2c9b872 | 710:e85f29b28b84 |
---|---|
1 import mock | 1 import mock |
2 import pytest | 2 import pytest |
3 from piecrust.uriutil import UriInfo, parse_uri, split_sub_uri | 3 from piecrust.uriutil import split_sub_uri |
4 | |
5 | |
6 @pytest.mark.parametrize('routes, uri, expected', [ | |
7 ({}, '/foo', None), | |
8 ( | |
9 {'/articles/%slug%': {'source': 'dummy'}}, | |
10 '/articles/foo', | |
11 UriInfo('', 'dummy', {'slug': 'foo'})), | |
12 ( | |
13 {'/foo/%bar%': {'source': 'foo'}, | |
14 '/other/%one%-%two%': {'source': 'other'}}, | |
15 '/other/some-thing', | |
16 UriInfo('', 'other', {'one': 'some', 'two': 'thing'})) | |
17 ]) | |
18 def test_parse_uri(routes, uri, expected): | |
19 if expected is not None: | |
20 expected.uri = uri | |
21 for pattern, args in routes.items(): | |
22 if 'taxonomy' not in args: | |
23 args['taxonomy'] = None | |
24 | |
25 actual = parse_uri(routes, uri) | |
26 assert actual == expected | |
27 | 4 |
28 | 5 |
29 @pytest.mark.parametrize('uri, expected, pretty_urls', [ | 6 @pytest.mark.parametrize('uri, expected, pretty_urls', [ |
30 ('/', ('/', 1), True), | 7 ('/', ('/', 1), True), |
31 ('/2', ('/', 2), True), | 8 ('/2', ('/', 2), True), |