From a37220b84dee4cc8b1b12f34643ce97dad89ffe1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 14 Sep 2009 08:15:01 +0000 Subject: - The ``view`` attribute of the ``view`` ZCML directive is no longer required if the ZCML directive has a ``template`` attribute. --- repoze/bfg/tests/test_zcml.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'repoze/bfg/tests') diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py index dcf6e17f8..208e8e754 100644 --- a/repoze/bfg/tests/test_zcml.py +++ b/repoze/bfg/tests/test_zcml.py @@ -355,6 +355,35 @@ class TestViewDirective(unittest.TestCase): result = wrapper(None, None) self.assertEqual(result.body, 'Hello.\n') + def test_with_template_no_view_callable(self): + from zope.interface import Interface + from zope.component import getSiteManager + from repoze.bfg.interfaces import IRequest + from repoze.bfg.interfaces import IView + from repoze.bfg.interfaces import IViewPermission + + import repoze.bfg.tests + + context = DummyContext(repoze.bfg.tests) + class IFoo(Interface): + pass + import os + fixture = 'fixtures/minimal.txt' + self._callFUT(context, 'repoze.view', IFoo, template=fixture) + actions = context.actions + self.assertEqual(len(actions), 1) + + action = actions[0] + discrim = ('view', IFoo, '', IRequest, IView, None, None, None, None, + None) + self.assertEqual(action['discriminator'], discrim) + register = action['callable'] + register() + sm = getSiteManager() + wrapper = sm.adapters.lookup((IFoo, IRequest), IView, name='') + result = wrapper(None, None) + self.assertEqual(result.body, 'Hello.\n') + def test_request_type_asinterface(self): from zope.component import getSiteManager from zope.interface import Interface -- cgit v1.2.3