| 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 |