From 0bf2866211d095a18a5c61d7af644c8e17486e6e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 16 Dec 2009 22:05:13 +0000 Subject: Bug Fixes --------- - When a route with the same name as a previously registered route was added, the old route was not removed from the mapper's routelist. Symptom: the old registered route would be used (and possibly matched) during route lookup when it should not have had a chance to ever be used. --- repoze/bfg/tests/test_urldispatch.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'repoze/bfg/tests/test_urldispatch.py') diff --git a/repoze/bfg/tests/test_urldispatch.py b/repoze/bfg/tests/test_urldispatch.py index 84484b692..861a4fd05 100644 --- a/repoze/bfg/tests/test_urldispatch.py +++ b/repoze/bfg/tests/test_urldispatch.py @@ -67,6 +67,17 @@ class RoutesMapperTests(unittest.TestCase): self.assertEqual(result['match'], None) self.assertEqual(result['route'], None) + def test_connect_name_exists_removes_old(self): + mapper = self._makeOne() + mapper.connect('archives/:action/:article', 'foo') + mapper.connect('archives/:action/:article2', 'foo') + self.assertEqual(len(mapper.routelist), 1) + self.assertEqual(len(mapper.routes), 1) + self.assertEqual(mapper.routes['foo'].path, + 'archives/:action/:article2') + self.assertEqual(mapper.routelist[0].path, + 'archives/:action/:article2') + def test_route_matches(self): mapper = self._makeOne() mapper.connect('archives/:action/:article', 'foo') -- cgit v1.2.3