summaryrefslogtreecommitdiff
path: root/tests/test_config/test_routes.py
diff options
context:
space:
mode:
authorMichael Merickel <github@m.merickel.org>2018-11-12 20:07:15 -0600
committerGitHub <noreply@github.com>2018-11-12 20:07:15 -0600
commit7429fcb5a96aa10bbe86da08bd0b30c9292efdde (patch)
tree548defadbf50447b4e6a0b1f9363f3d08ded8bfc /tests/test_config/test_routes.py
parent420ea05bee3ad376c4369f401b2696b31312c5e1 (diff)
parent2d32ae81abc473fb21b4bc42aec479c656693f1c (diff)
downloadpyramid-7429fcb5a96aa10bbe86da08bd0b30c9292efdde.tar.gz
pyramid-7429fcb5a96aa10bbe86da08bd0b30c9292efdde.tar.bz2
pyramid-7429fcb5a96aa10bbe86da08bd0b30c9292efdde.zip
Merge pull request #3420 from mmerickel/bare-route-prefix-2
support inherit_slash=True on add_route
Diffstat (limited to 'tests/test_config/test_routes.py')
-rw-r--r--tests/test_config/test_routes.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_config/test_routes.py b/tests/test_config/test_routes.py
index 32a64b4bd..e6540c343 100644
--- a/tests/test_config/test_routes.py
+++ b/tests/test_config/test_routes.py
@@ -54,6 +54,30 @@ class RoutesConfiguratorMixinTests(unittest.TestCase):
config.add_route('name', 'path')
self._assertRoute(config, 'name', 'root/path')
+ def test_add_route_with_inherit_errors(self):
+ from pyramid.exceptions import ConfigurationError
+
+ config = self._makeOne(autocommit=True)
+ self.assertRaises(
+ ConfigurationError,
+ config.add_route,
+ 'name',
+ '/',
+ inherit_slash=True,
+ )
+
+ def test_add_route_with_route_prefix_with_inherit_slash(self):
+ config = self._makeOne(autocommit=True)
+ config.route_prefix = 'root'
+ config.add_route('name', '', inherit_slash=True)
+ self._assertRoute(config, 'name', 'root')
+
+ def test_add_route_with_root_slash_with_route_prefix(self):
+ config = self._makeOne(autocommit=True)
+ config.route_prefix = 'root'
+ config.add_route('name', '/')
+ self._assertRoute(config, 'name', 'root/')
+
def test_add_route_discriminator(self):
config = self._makeOne()
config.add_route('name', 'path')