diff options
Diffstat (limited to 'repoze/bfg/tests/test_push.py')
| -rw-r--r-- | repoze/bfg/tests/test_push.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_push.py b/repoze/bfg/tests/test_push.py new file mode 100644 index 000000000..907503983 --- /dev/null +++ b/repoze/bfg/tests/test_push.py @@ -0,0 +1,37 @@ +import unittest + +from zope.component.testing import PlacelessSetup + +class Test_pushpage(unittest.TestCase, PlacelessSetup): + def setUp(self): + PlacelessSetup.setUp(self) + + def tearDown(self): + PlacelessSetup.tearDown(self) + + def _zcmlConfigure(self): + import repoze.bfg + import zope.configuration.xmlconfig + zope.configuration.xmlconfig.file('configure.zcml', package=repoze.bfg) + + def _getTargetClass(self): + from repoze.bfg.push import pushpage + return pushpage + + def _makeOne(self, template): + return self._getTargetClass()(template) + + def test_decorated_has_same_name_as_wrapped(self): + pp = self._makeOne('pp.pt') + wrapped = pp(to_wrap) + self.assertEqual(wrapped.__name__, 'to_wrap') + + def test___call___passes_names_from_wrapped(self): + self._zcmlConfigure() + pp = self._makeOne('pp.pt') + wrapped = pp(to_wrap) + response = wrapped(object(), object()) + self.assertEqual(response.body, '<p>WRAPPED</p>') + +def to_wrap(context, request): + return {'wrapped': 'WRAPPED'} |
