diff options
author | Tim Graham <timograham@gmail.com> | 2016-05-10 12:46:47 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-05-10 12:46:47 -0400 |
commit | 2f0e0eee450775a71ac3eb42707dcd970ede42c8 (patch) | |
tree | 26149ef4a5feb6317f9b52c79239ca524a5bded4 /tests/utils_tests | |
parent | c3e108694966f045adcc0ba11133a2b3bf238770 (diff) | |
download | django-2f0e0eee450775a71ac3eb42707dcd970ede42c8.tar.gz |
Fixed #24046 -- Deprecated the "escape" half of utils.safestring.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r-- | tests/utils_tests/test_safestring.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py index 7cc92a1370..6ea3972f78 100644 --- a/tests/utils_tests/test_safestring.py +++ b/tests/utils_tests/test_safestring.py @@ -1,8 +1,9 @@ from __future__ import unicode_literals from django.template import Context, Template -from django.test import SimpleTestCase +from django.test import SimpleTestCase, ignore_warnings from django.utils import html, six, text +from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_bytes from django.utils.functional import lazy, lazystr from django.utils.safestring import ( @@ -62,11 +63,13 @@ class SafeStringTest(SimpleTestCase): def test_mark_safe_lazy_result_implements_dunder_html(self): self.assertEqual(mark_safe(lazystr('a&b')).__html__(), 'a&b') + @ignore_warnings(category=RemovedInDjango20Warning) def test_mark_for_escaping(self): s = mark_for_escaping('a&b') self.assertRenderEqual('{{ s }}', 'a&b', s=s) self.assertRenderEqual('{{ s }}', 'a&b', s=mark_for_escaping(s)) + @ignore_warnings(category=RemovedInDjango20Warning) def test_mark_for_escaping_object_implementing_dunder_html(self): e = customescape('<a&b>') s = mark_for_escaping(e) @@ -75,6 +78,7 @@ class SafeStringTest(SimpleTestCase): self.assertRenderEqual('{{ s }}', '<<a&b>>', s=s) self.assertRenderEqual('{{ s|force_escape }}', '<a&b>', s=s) + @ignore_warnings(category=RemovedInDjango20Warning) def test_mark_for_escaping_lazy(self): s = lazystr('a&b') b = lazybytes(b'a&b') @@ -83,6 +87,7 @@ class SafeStringTest(SimpleTestCase): self.assertIsInstance(mark_for_escaping(b), EscapeData) self.assertRenderEqual('{% autoescape off %}{{ s }}{% endautoescape %}', 'a&b', s=mark_for_escaping(s)) + @ignore_warnings(category=RemovedInDjango20Warning) def test_mark_for_escaping_object_implementing_dunder_str(self): class Obj(object): def __str__(self): |