blob: c05387098d6cc778180933dd16943d10e8552577 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from django.test import SimpleTestCase
from ..utils import setup
class SafeTests(SimpleTestCase):
@setup({'safe01': '{{ a }} -- {{ a|safe }}'})
def test_safe01(self):
output = self.engine.render_to_string('safe01', {'a': '<b>hello</b>'})
self.assertEqual(output, '<b>hello</b> -- <b>hello</b>')
@setup({'safe02': '{% autoescape off %}{{ a }} -- {{ a|safe }}{% endautoescape %}'})
def test_safe02(self):
output = self.engine.render_to_string('safe02', {'a': '<b>hello</b>'})
self.assertEqual(output, '<b>hello</b> -- <b>hello</b>')
|