diff options
| author | SusanTan <onceuponatimeforever@gmail.com> | 2013-08-21 11:23:53 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-24 09:19:55 -0400 |
| commit | f33db5a09acfc3df3085235a5712c46094eb9a0d (patch) | |
| tree | f2d7c9ff529588f9d10c5f3aa4bc4ace92e3ffe7 /tests | |
| parent | 35230adf6351ac81f02088a240bf861914a050ee (diff) | |
Fixed 19949 -- Cached template loader now caches TemplateDoesNotExist
Thanks @timgraham and @jdunck for the code reviews and Kronuz for bug
report and initial patch.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/template_tests/test_loaders.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py index 6fd17fd04b..7caadcd9a5 100644 --- a/tests/template_tests/test_loaders.py +++ b/tests/template_tests/test_loaders.py @@ -105,6 +105,7 @@ class EggLoaderTest(unittest.TestCase): egg_loader = EggLoader() self.assertRaises(TemplateDoesNotExist, egg_loader.load_template_source, "y.html") + class CachedLoader(unittest.TestCase): def setUp(self): self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS @@ -127,6 +128,16 @@ class CachedLoader(unittest.TestCase): # The two templates should not have the same content self.assertNotEqual(t1.render(Context({})), t2.render(Context({}))) + def test_missing_template_is_cached(self): + "Check that the missing template is cached." + template_loader = loader.find_template_loader(settings.TEMPLATE_LOADERS[0]) + # Empty cache, which may be filled from previous tests. + template_loader.reset() + # Check that 'missing.html' isn't already in cache before 'missing.html' is loaed + self.assertRaises(KeyError, lambda: template_loader.template_cache["missing.html"]) + self.assertRaises(TemplateDoesNotExist, template_loader.load_template, "missing.html") + + class RenderToStringTest(unittest.TestCase): def setUp(self): |
