summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/template_backends/test_django.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/template_backends/test_django.py b/tests/template_backends/test_django.py
index 8d13aaee08..1a93a82274 100644
--- a/tests/template_backends/test_django.py
+++ b/tests/template_backends/test_django.py
@@ -1,5 +1,6 @@
from template_tests.test_response import test_processor_name
+from django.template import EngineHandler
from django.template.backends.django import DjangoTemplates
from django.template.library import InvalidTemplateLibrary
from django.test import RequestFactory, override_settings
@@ -108,3 +109,24 @@ class DjangoTemplatesTests(TemplateStringsTests):
'template_backends.apps.good.templatetags.good_tags',
]
)
+
+ def test_autoescape_off(self):
+ templates = [{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'OPTIONS': {'autoescape': False},
+ }]
+ engines = EngineHandler(templates=templates)
+ self.assertEqual(
+ engines['django'].from_string('Hello, {{ name }}').render({'name': 'Bob & Jim'}),
+ 'Hello, Bob & Jim'
+ )
+
+ def test_autoescape_default(self):
+ templates = [{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ }]
+ engines = EngineHandler(templates=templates)
+ self.assertEqual(
+ engines['django'].from_string('Hello, {{ name }}').render({'name': 'Bob & Jim'}),
+ 'Hello, Bob & Jim'
+ )