diff options
author | Ben Bangert <ben@groovie.org> | 2020-07-30 11:01:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-30 11:01:37 -0700 |
commit | 12758f026dd4ea59398d2ec28d38fbc3f0e7c80e (patch) | |
tree | 18c6727921013bcc16444698a9e70977b26f4df3 /tests | |
parent | 3c01ff0ecee7abdd25a5812c5d3a9bfcb1df732d (diff) | |
parent | d312ea6dfea57a11b75d25f8b1c0c89d6cf854e6 (diff) | |
download | routes-12758f026dd4ea59398d2ec28d38fbc3f0e7c80e.tar.gz |
Merge branch 'master' into fix-python-warnings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_functional/test_explicit_use.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/test_functional/test_explicit_use.py b/tests/test_functional/test_explicit_use.py index ccd3b7a..b1e1cd7 100644 --- a/tests/test_functional/test_explicit_use.py +++ b/tests/test_functional/test_explicit_use.py @@ -1,6 +1,6 @@ """test_explicit_use""" import os, sys, time, unittest -from nose.tools import eq_, assert_raises +from nose.tools import eq_, assert_raises, assert_is_none from routes import * from routes.route import Route @@ -101,6 +101,34 @@ class TestUtils(unittest.TestCase): map.extend(routes) eq_(map.match('/foo'), {}) + def test_add_routes_conditions_unmet(self): + map = Mapper(explicit=True) + map.minimization = False + routes = [ + Route('foo', '/foo', conditions=dict(method=["POST"])) + ] + environ = { + 'HTTP_HOST': 'localhost.com', + 'PATH_INFO': '/foo', + 'REQUEST_METHOD': 'GET', + } + map.extend(routes) + assert_is_none(map.match('/foo', environ=environ)) + + def test_add_routes_conditions_met(self): + map = Mapper(explicit=True) + map.minimization = False + routes = [ + Route('foo', '/foo', conditions=dict(method=["POST"])) + ] + environ = { + 'HTTP_HOST': 'localhost.com', + 'PATH_INFO': '/foo', + 'REQUEST_METHOD': 'POST', + } + map.extend(routes) + eq_(map.match('/foo', environ=environ), {}) + def test_using_func(self): def fred(view): pass |