diff options
Diffstat (limited to 'tests/test_functional/test_explicit_use.py')
-rw-r--r-- | tests/test_functional/test_explicit_use.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/test_functional/test_explicit_use.py b/tests/test_functional/test_explicit_use.py index 3f667c4..d6e1879 100644 --- a/tests/test_functional/test_explicit_use.py +++ b/tests/test_functional/test_explicit_use.py @@ -11,19 +11,19 @@ class TestUtils(unittest.TestCase): m = Mapper() m.explicit = True m.connect('/hi/{fred}') - + environ = {'HTTP_HOST': 'localhost'} - + env = environ.copy() env['PATH_INFO'] = '/hi/george' - + eq_({'fred': 'george'}, m.match(environ=env)) def test_x_forwarded(self): m = Mapper() m.explicit = True m.connect('/hi/{fred}') - + environ = {'HTTP_X_FORWARDED_HOST': 'localhost'} url = URLGenerator(m, environ) eq_('http://localhost/hi/smith', url(fred='smith', qualified=True)) @@ -32,7 +32,7 @@ class TestUtils(unittest.TestCase): m = Mapper() m.explicit = True m.connect('/hi/{fred}') - + environ = {'SERVER_NAME': 'localhost', 'wsgi.url_scheme': 'https', 'SERVER_PORT': '993'} url = URLGenerator(m, environ) @@ -43,15 +43,15 @@ class TestUtils(unittest.TestCase): m.explicit = True m.sub_domains = True m.connect('/hi/{fred}') - + environ = {'HTTP_HOST': 'localhost.com'} url = URLGenerator(m, environ) eq_('http://home.localhost.com/hi/smith', url(fred='smith', sub_domain=u'home', qualified=True)) - + environ = {'HTTP_HOST': 'here.localhost.com', 'PATH_INFO': '/hi/smith'} url = URLGenerator(m, environ.copy()) assert_raises(GenerationException, lambda: url.current(qualified=True)) - + url = URLGenerator(m, {}) eq_('/hi/smith', url(fred='smith', sub_domain=u'home')) @@ -59,7 +59,7 @@ class TestUtils(unittest.TestCase): m = Mapper() m.explicit = True m.connect('/hi/{fred}') - + environ = {'HTTP_HOST': 'localhost.com'} url = URLGenerator(m, environ) eq_('/hi/smith#here', url(fred='smith', anchor='here')) @@ -68,16 +68,16 @@ class TestUtils(unittest.TestCase): m = Mapper() m.explicit = True m.connect('http://google.com/', _static=True) - + url = URLGenerator(m, {}) - + eq_('/here?q=fred&q=here%20now', url('/here', q=[u'fred', 'here now'])) - + def test_current(self): m = Mapper() m.explicit = True m.connect('/hi/{fred}') - + environ = {'HTTP_HOST': 'localhost.com', 'PATH_INFO': '/hi/smith'} match = m.routematch(environ=environ)[0] environ['wsgiorg.routing_args'] = (None, match) @@ -92,30 +92,30 @@ class TestUtils(unittest.TestCase): ] map.extend(routes) eq_(map.match('/foo'), {}) - + def test_using_func(self): def fred(view): pass - + m = Mapper() m.explicit = True m.connect('/hi/{fred}', controller=fred) - + environ = {'HTTP_HOST': 'localhost.com', 'PATH_INFO': '/hi/smith'} match = m.routematch(environ=environ)[0] environ['wsgiorg.routing_args'] = (None, match) url = URLGenerator(m, environ) eq_('/hi/smith', url.current()) - + def test_using_prefix(self): m = Mapper() m.explicit = True m.connect('/{first}/{last}') - + environ = {'HTTP_HOST': 'localhost.com', 'PATH_INFO': '/content/index', 'SCRIPT_NAME': '/jones'} match = m.routematch(environ=environ)[0] environ['wsgiorg.routing_args'] = (None, match) url = URLGenerator(m, environ) - + eq_('/jones/content/index', url.current()) eq_('/jones/smith/barney', url(first='smith', last='barney')) |