summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2008-04-05 20:38:14 -0700
committerPhilip Jenvey <pjenvey@underboss.org>2008-04-05 20:38:14 -0700
commitd7d7edac26e614bc69913045fb09f24bbe63ea3f (patch)
tree94f407475ed418c0f897f7160d6f29a85673e365 /tests
parent7e25647be16fc1e56315fea5917a3f0fb69c33de (diff)
downloadroutes-d7d7edac26e614bc69913045fb09f24bbe63ea3f.tar.gz
don't assume dict ordering
--HG-- branch : trunk
Diffstat (limited to 'tests')
-rw-r--r--tests/test_functional/test_middleware.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/test_functional/test_middleware.py b/tests/test_functional/test_middleware.py
index aa6c4d3..68b77b6 100644
--- a/tests/test_functional/test_middleware.py
+++ b/tests/test_functional/test_middleware.py
@@ -5,7 +5,9 @@ from webtest import TestApp
def simple_app(environ, start_response):
route_dict = environ['wsgiorg.routing_args'][1]
start_response('200 OK', [('Content-type', 'text/plain')])
- return ['The matchdict is %s and environ is %s' % (route_dict, environ)]
+ items = route_dict.items()
+ items.sort()
+ return ['The matchdict items are %s and environ is %s' % (items, environ)]
def test_basic():
map = Mapper()
@@ -13,10 +15,10 @@ def test_basic():
map.create_regs(['content'])
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
- assert 'matchdict is {}' in res
+ assert 'matchdict items are []' in res
res = app.get('/content')
- assert "matchdict is {'action': 'index', 'controller': u'content', 'id': None}" in res
+ assert "matchdict items are [('action', 'index'), ('controller', u'content'), ('id', None)]" in res
def test_path_info():
map = Mapper()
@@ -25,11 +27,11 @@ def test_path_info():
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
- assert 'matchdict is {}' in res
+ assert 'matchdict items are []' in res
res = app.get('/myapp/some/other/url')
print res
- assert "matchdict is {'action': u'index', 'controller': u'myapp', 'path_info': 'some/other/url'}" in res
+ assert "matchdict items are [('action', u'index'), ('controller', u'myapp'), ('path_info', 'some/other/url')]" in res
assert "'SCRIPT_NAME': '/myapp'" in res
assert "'PATH_INFO': '/some/other/url'" in res
@@ -40,22 +42,22 @@ def test_method_conversion():
map.create_regs(['content'])
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
- assert 'matchdict is {}' in res
+ assert 'matchdict items are []' in res
res = app.get('/content')
- assert "matchdict is {'action': 'index', 'controller': u'content', 'id': None}" in res
+ assert "matchdict items are [('action', 'index'), ('controller', u'content'), ('id', None)]" in res
res = app.get('/content/hopper', params={'_method':'DELETE'})
- assert "matchdict is {'action': u'index', 'controller': u'content', 'type': u'hopper'}" in res
+ assert "matchdict items are [('action', u'index'), ('controller', u'content'), ('type', u'hopper')]" in res
res = app.post('/content/grind',
params={'_method':'DELETE', 'name':'smoth'},
headers={'Content-Type': 'application/x-www-form-urlencoded'})
- assert "matchdict is {'action': u'index', 'controller': u'content', 'type': u'grind'}" in res
+ assert "matchdict items are [('action', u'index'), ('controller', u'content'), ('type', u'grind')]" in res
assert "'REQUEST_METHOD': 'POST'" in res
res = app.post('/content/grind',
upload_files=[('fileupload', 'hello.txt', 'Hello World')],
params={'_method':'DELETE', 'name':'smoth'})
- assert "matchdict is {'action': u'index', 'controller': u'content', 'type': u'grind'}" in res
+ assert "matchdict items are [('action', u'index'), ('controller', u'content'), ('type', u'grind')]" in res
assert "'REQUEST_METHOD': 'POST'" in res