1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
Fix tests to work with random hash dicts.
--- a/tests/test_functional/test_generation.py
+++ b/tests/test_functional/test_generation.py
@@ -205,13 +205,14 @@ class TestGeneration(unittest.TestCase):
requirements={'month':'\d{1,2}','day':'\d{1,2}'})
m.connect('viewpost/:id', controller='post', action='view')
m.connect(':controller/:action/:id')
-
- eq_('/blog/view?year=2004&month=blah', m.generate(controller='blog', action='view', year=2004, month='blah'))
+
+ url = m.generate(controller='blog', action='view', year=2004, month='blah')
+ assert url == '/blog/view?year=2004&month=blah' or url == '/blog/view?month=blah&year=2004'
eq_('/archive/2004/11', m.generate(controller='blog', action='view', year=2004, month=11))
eq_('/archive/2004/11', m.generate(controller='blog', action='view', year=2004, month='11'))
eq_('/archive/2004', m.generate(controller='blog', action='view', year=2004))
eq_('/viewpost/3', m.generate(controller='post', action='view', id=3))
-
+
def test_multiroute_with_splits(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -219,13 +220,14 @@ class TestGeneration(unittest.TestCase):
requirements={'month':'\d{1,2}','day':'\d{1,2}'})
m.connect('viewpost/:(id)', controller='post', action='view')
m.connect(':(controller)/:(action)/:(id)')
-
- eq_('/blog/view?year=2004&month=blah', m.generate(controller='blog', action='view', year=2004, month='blah'))
+
+ url = m.generate(controller='blog', action='view', year=2004, month='blah')
+ assert url == '/blog/view?year=2004&month=blah' or url == '/blog/view?month=blah&year=2004'
eq_('/archive/2004/11', m.generate(controller='blog', action='view', year=2004, month=11))
eq_('/archive/2004/11', m.generate(controller='blog', action='view', year=2004, month='11'))
eq_('/archive/2004', m.generate(controller='blog', action='view', year=2004))
eq_('/viewpost/3', m.generate(controller='post', action='view', id=3))
-
+
def test_big_multiroute(self):
m = Mapper(explicit=False)
m.minimization = True
|