diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/template_tests/filter_tests/test_removetags.py | 49 | ||||
| -rw-r--r-- | tests/utils_tests/test_html.py | 32 |
2 files changed, 1 insertions, 80 deletions
diff --git a/tests/template_tests/filter_tests/test_removetags.py b/tests/template_tests/filter_tests/test_removetags.py deleted file mode 100644 index 9cc6c5a4f9..0000000000 --- a/tests/template_tests/filter_tests/test_removetags.py +++ /dev/null @@ -1,49 +0,0 @@ -from django.template.defaultfilters import removetags -from django.test import SimpleTestCase, ignore_warnings -from django.utils.deprecation import RemovedInDjango110Warning -from django.utils.safestring import mark_safe - -from ..utils import setup - - -@ignore_warnings(category=RemovedInDjango110Warning) -class RemovetagsTests(SimpleTestCase): - - @setup({'removetags01': '{{ a|removetags:"a b" }} {{ b|removetags:"a b" }}'}) - def test_removetags01(self): - output = self.engine.render_to_string( - 'removetags01', - { - 'a': '<a>x</a> <p><b>y</b></p>', - 'b': mark_safe('<a>x</a> <p><b>y</b></p>'), - }, - ) - self.assertEqual(output, 'x <p>y</p> x <p>y</p>') - - @setup({'removetags02': - '{% autoescape off %}{{ a|removetags:"a b" }} {{ b|removetags:"a b" }}{% endautoescape %}'}) - def test_removetags02(self): - output = self.engine.render_to_string( - 'removetags02', - { - 'a': '<a>x</a> <p><b>y</b></p>', - 'b': mark_safe('<a>x</a> <p><b>y</b></p>'), - }, - ) - self.assertEqual(output, 'x <p>y</p> x <p>y</p>') - - -@ignore_warnings(category=RemovedInDjango110Warning) -class FunctionTests(SimpleTestCase): - - def test_removetags(self): - self.assertEqual( - removetags( - 'some <b>html</b> with <script>alert("You smell")</script> disallowed <img /> tags', - 'script img', - ), - 'some <b>html</b> with alert("You smell") disallowed tags', - ) - - def test_non_string_input(self): - self.assertEqual(removetags(123, 'a'), '123') diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py index 298aa304a3..ed026f0a28 100644 --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -4,10 +4,9 @@ from __future__ import unicode_literals import os from datetime import datetime -from django.test import SimpleTestCase, ignore_warnings +from django.test import SimpleTestCase from django.utils import html, safestring, six from django.utils._os import upath -from django.utils.deprecation import RemovedInDjango110Warning from django.utils.encoding import force_text @@ -123,25 +122,6 @@ class TestUtilsHtml(SimpleTestCase): for value, output in items: self.check_output(f, value, output) - @ignore_warnings(category=RemovedInDjango110Warning) - def test_strip_entities(self): - f = html.strip_entities - # Strings that should come out untouched. - values = ("&", "&a", "&a", "a&#a") - for value in values: - self.check_output(f, value) - # Valid entities that should be stripped from the patterns. - entities = ("", "", "&a;", "&fdasdfasdfasdf;") - patterns = ( - ("asdf %(entity)s ", "asdf "), - ("%(entity)s%(entity)s", ""), - ("&%(entity)s%(entity)s", "&"), - ("%(entity)s3", "3"), - ) - for entity in entities: - for in_pattern, output in patterns: - self.check_output(f, in_pattern % {'entity': entity}, output) - def test_escapejs(self): f = html.escapejs items = ( @@ -160,16 +140,6 @@ class TestUtilsHtml(SimpleTestCase): for value, output in items: self.check_output(f, value, output) - @ignore_warnings(category=RemovedInDjango110Warning) - def test_remove_tags(self): - f = html.remove_tags - items = ( - ("<b><i>Yes</i></b>", "b i", "Yes"), - ("<a>x</a> <p><b>y</b></p>", "a b", "x <p>y</p>"), - ) - for value, tags, output in items: - self.assertEqual(f(value, tags), output) - def test_smart_urlquote(self): quote = html.smart_urlquote # Ensure that IDNs are properly quoted |
