From dff0798e352d0afeeec2058200ac983692b606c2 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 11 Nov 2018 22:39:52 -0600 Subject: use inherit_slash=True on add_route to opt-in to no trailing slash --- tests/test_config/test_routes.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/test_config') diff --git a/tests/test_config/test_routes.py b/tests/test_config/test_routes.py index 1c1ed6700..e6540c343 100644 --- a/tests/test_config/test_routes.py +++ b/tests/test_config/test_routes.py @@ -54,10 +54,22 @@ class RoutesConfiguratorMixinTests(unittest.TestCase): config.add_route('name', 'path') self._assertRoute(config, 'name', 'root/path') - def test_add_route_with_empty_string_with_route_prefix(self): + 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', '') + config.add_route('name', '', inherit_slash=True) self._assertRoute(config, 'name', 'root') def test_add_route_with_root_slash_with_route_prefix(self): -- cgit v1.2.3