diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-11-12 01:47:33 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-11-12 01:47:33 +0000 |
| commit | 9c4a7271c71fa17827df8adefb07fe4bb2c3e2a7 (patch) | |
| tree | b3f1eb8d7dc68f7cd42a990a12692f0424287b1b | |
| parent | c37d6ac18aaeb839fd38b2ef4a1a66b264ba3888 (diff) | |
| download | pyramid-9c4a7271c71fa17827df8adefb07fe4bb2c3e2a7.tar.gz pyramid-9c4a7271c71fa17827df8adefb07fe4bb2c3e2a7.tar.bz2 pyramid-9c4a7271c71fa17827df8adefb07fe4bb2c3e2a7.zip | |
Test alsoProvides.
| -rw-r--r-- | repoze/bfg/tests/test_urldispatch.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_urldispatch.py b/repoze/bfg/tests/test_urldispatch.py index 803f4503f..ecc76fe04 100644 --- a/repoze/bfg/tests/test_urldispatch.py +++ b/repoze/bfg/tests/test_urldispatch.py @@ -106,6 +106,29 @@ class RoutesRootFactoryTests(unittest.TestCase): self.assertEqual(request.matchdict, routing_args) self.failUnless(req_iface.providedBy(request)) + def test_route_matches_already_has_iface(self): + from zope.interface import Interface + from zope.interface import directlyProvides + root_factory = DummyRootFactory(123) + req_iface = self._registerRouteRequest('foo') + mapper = self._makeOne(root_factory) + mapper.connect('archives/:action/:article', 'foo') + request = self._getRequest(PATH_INFO='/archives/action1/article1') + class IFoo(Interface): + pass + directlyProvides(request, IFoo) + result = mapper(request) + self.assertEqual(result, 123) + environ = request.environ + routing_args = environ['wsgiorg.routing_args'][1] + self.assertEqual(routing_args['action'], 'action1') + self.assertEqual(routing_args['article'], 'article1') + self.assertEqual(environ['bfg.routes.matchdict'], routing_args) + self.assertEqual(environ['bfg.routes.route'].name, 'foo') + self.assertEqual(request.matchdict, routing_args) + self.failUnless(req_iface.providedBy(request)) + self.failUnless(IFoo.providedBy(request)) + def test_route_matches_and_has_factory(self): root_factory = DummyRootFactory(123) req_iface = self._registerRouteRequest('foo') |
