summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Tsouvarev <tsouvarev@gmail.com>2016-02-26 09:49:02 +0300
committerTim Graham <timograham@gmail.com>2016-02-26 08:02:34 -0500
commitcd46947ddb6719c819e75464d6aa0a10a6c10fad (patch)
tree146bab6b02ca963b1ec1aaf06222fc7778ae89e4 /tests
parent911a77fcca49a92d0750b7f7d573ea2dcf77a1a9 (diff)
[1.9.x] Fixed #26280 -- Fixed cached template loader crash when loading nonexistent template.
Backport of 8890c533e0b53cb0021bd5faf15668430cd3075a from master
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/test_loaders.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py
index 3614793564..11f20c6deb 100644
--- a/tests/template_tests/test_loaders.py
+++ b/tests/template_tests/test_loaders.py
@@ -87,6 +87,18 @@ class CachedLoaderTests(SimpleTestCase):
"Cached loader failed to cache the TemplateDoesNotExist exception",
)
+ @ignore_warnings(category=RemovedInDjango20Warning)
+ def test_load_nonexistent_cached_template(self):
+ loader = self.engine.template_loaders[0]
+ template_name = 'nonexistent.html'
+
+ # fill the template cache
+ with self.assertRaises(TemplateDoesNotExist):
+ loader.find_template(template_name)
+
+ with self.assertRaisesMessage(TemplateDoesNotExist, template_name):
+ loader.get_template(template_name)
+
def test_templatedir_caching(self):
"""
#13573 -- Template directories should be part of the cache key.