summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_chameleon_zpt.py
diff options
context:
space:
mode:
Diffstat (limited to 'repoze/bfg/tests/test_chameleon_zpt.py')
-rw-r--r--repoze/bfg/tests/test_chameleon_zpt.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_chameleon_zpt.py b/repoze/bfg/tests/test_chameleon_zpt.py
index e4bf8f766..cbf9dd10b 100644
--- a/repoze/bfg/tests/test_chameleon_zpt.py
+++ b/repoze/bfg/tests/test_chameleon_zpt.py
@@ -21,6 +21,16 @@ class Base(object):
return reg
class ZPTTemplateRendererTests(Base, unittest.TestCase):
+ def setUp(self):
+ from repoze.bfg.configuration import Configurator
+ from repoze.bfg.registry import Registry
+ registry = Registry()
+ self.config = Configurator(registry=registry)
+ self.config.begin()
+
+ def tearDown(self):
+ self.config.end()
+
def _getTargetClass(self):
from repoze.bfg.chameleon_zpt import ZPTTemplateRenderer
return ZPTTemplateRenderer
@@ -55,6 +65,16 @@ class ZPTTemplateRendererTests(Base, unittest.TestCase):
template = instance.template
self.assertEqual(template, instance.__dict__['template'])
+ def test_template_with_ichameleon_translate(self):
+ from repoze.bfg.interfaces import IChameleonTranslate
+ def ct(): pass
+ self.config.registry.registerUtility(ct, IChameleonTranslate)
+ minimal = self._getTemplatePath('minimal.pt')
+ instance = self._makeOne(minimal)
+ self.failIf('template' in instance.__dict__)
+ template = instance.template
+ self.assertEqual(template.translate, ct)
+
def test_call_with_nondict_value(self):
minimal = self._getTemplatePath('minimal.pt')
instance = self._makeOne(minimal)