diff tests/test_uriutil.py @ 316:eb958151c8dc

tests: Bad me, the tests were broken. Now they're fixed.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 28 Mar 2015 12:41:02 -0700
parents 62c7a97c8340
children 422052d2e978
line wrap: on
line diff
--- a/tests/test_uriutil.py	Fri Mar 27 20:47:31 2015 -0700
+++ b/tests/test_uriutil.py	Sat Mar 28 12:41:02 2015 -0700
@@ -1,6 +1,6 @@
 import mock
 import pytest
-from piecrust.uriutil import UriInfo, parse_uri, get_first_sub_uri
+from piecrust.uriutil import UriInfo, parse_uri, split_sub_uri
 
 
 @pytest.mark.parametrize('routes, uri, expected', [
@@ -27,20 +27,20 @@
 
 
 @pytest.mark.parametrize('uri, expected, pretty_urls', [
-    ('foo/bar', 'foo/bar', True),
-    ('foo/bar/2', 'foo/bar', True),
-    ('foo/bar.ext', 'foo/bar.ext', True),
-    ('foo/bar.ext/2', 'foo/bar.ext', True),
-    ('foo/bar.html', 'foo/bar.html', False),
-    ('foo/bar/2.html', 'foo/bar.html', False),
-    ('foo/bar.ext', 'foo/bar.ext', False),
-    ('foo/bar/2.ext', 'foo/bar.ext', False)
+    ('foo/bar', ('foo/bar', 1), True),
+    ('foo/bar/2', ('foo/bar', 2), True),
+    ('foo/bar.ext', ('foo/bar.ext', 1), True),
+    ('foo/bar.ext/2', ('foo/bar.ext', 2), True),
+    ('foo/bar.html', ('foo/bar.html', 1), False),
+    ('foo/bar/2.html', ('foo/bar.html', 2), False),
+    ('foo/bar.ext', ('foo/bar.ext', 1), False),
+    ('foo/bar/2.ext', ('foo/bar.ext', 2), False)
     ])
-def test_get_first_sub_uri(uri, expected, pretty_urls):
+def test_split_sub_uri(uri, expected, pretty_urls):
     app = mock.MagicMock()
     app.config = {
             'site/pretty_urls': pretty_urls,
-            '__cache/pagination_suffix_re': '/(\\d+)$'}
-    actual = get_first_sub_uri(app, uri)
+            '__cache/pagination_suffix_re': '/(?P<num>\\d+)$'}
+    actual = split_sub_uri(app, uri)
     assert actual == expected