From 36ca7c9f7f1b177d69be792f98fda054d7c36c45 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 25 Apr 2010 17:23:45 +0000 Subject: Add tests for debug_templates (backfill for reload_templates). --- repoze/bfg/tests/test_chameleon_text.py | 16 ++++++++++++++++ repoze/bfg/tests/test_chameleon_zpt.py | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/repoze/bfg/tests/test_chameleon_text.py b/repoze/bfg/tests/test_chameleon_text.py index 204805adb..38bbc060c 100644 --- a/repoze/bfg/tests/test_chameleon_text.py +++ b/repoze/bfg/tests/test_chameleon_text.py @@ -74,6 +74,22 @@ class TextTemplateRendererTests(Base, unittest.TestCase): template = instance.template self.assertEqual(template.translate, ct) + def test_template_with_debug_templates(self): + self.config.add_settings({'debug_templates':True}) + minimal = self._getTemplatePath('minimal.txt') + instance = self._makeOne(minimal) + self.failIf('template' in instance.__dict__) + template = instance.template + self.assertEqual(template.debug, True) + + def test_template_with_reload_templates(self): + self.config.add_settings({'reload_templates':True}) + minimal = self._getTemplatePath('minimal.txt') + instance = self._makeOne(minimal) + self.failIf('template' in instance.__dict__) + template = instance.template + self.assertEqual(template.auto_reload, True) + def test_call(self): minimal = self._getTemplatePath('minimal.txt') instance = self._makeOne(minimal) diff --git a/repoze/bfg/tests/test_chameleon_zpt.py b/repoze/bfg/tests/test_chameleon_zpt.py index cbf9dd10b..b24a0430c 100644 --- a/repoze/bfg/tests/test_chameleon_zpt.py +++ b/repoze/bfg/tests/test_chameleon_zpt.py @@ -75,6 +75,22 @@ class ZPTTemplateRendererTests(Base, unittest.TestCase): template = instance.template self.assertEqual(template.translate, ct) + def test_template_with_debug_templates(self): + self.config.add_settings({'debug_templates':True}) + minimal = self._getTemplatePath('minimal.pt') + instance = self._makeOne(minimal) + self.failIf('template' in instance.__dict__) + template = instance.template + self.assertEqual(template.debug, True) + + def test_template_with_reload_templates(self): + self.config.add_settings({'reload_templates':True}) + minimal = self._getTemplatePath('minimal.pt') + instance = self._makeOne(minimal) + self.failIf('template' in instance.__dict__) + template = instance.template + self.assertEqual(template.auto_reload, True) + def test_call_with_nondict_value(self): minimal = self._getTemplatePath('minimal.pt') instance = self._makeOne(minimal) -- cgit v1.2.3