diff options
| author | Tim Graham <timograham@gmail.com> | 2015-03-10 18:40:33 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-10 18:58:34 -0400 |
| commit | 7b1a67cce52e5c191fbfa1bca501c6f0222db019 (patch) | |
| tree | b2c69097c92a1ffef7e49f9aecc71b004bf4c2f9 /tests/template_tests | |
| parent | 57d42aef97eb8fa45584f2e863ccfa2b7c98d4b7 (diff) | |
Fixed escaping regression in urlize filter.
Now that the URL is always unescaped as of refs #22267,
we should re-escape it before inserting it into the anchor.
Diffstat (limited to 'tests/template_tests')
| -rw-r--r-- | tests/template_tests/filter_tests/test_urlize.py | 10 | ||||
| -rw-r--r-- | tests/template_tests/filter_tests/test_urlizetrunc.py | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/template_tests/filter_tests/test_urlize.py b/tests/template_tests/filter_tests/test_urlize.py index ee6744e6cb..38a0a3e3ed 100644 --- a/tests/template_tests/filter_tests/test_urlize.py +++ b/tests/template_tests/filter_tests/test_urlize.py @@ -18,8 +18,8 @@ class UrlizeTests(SimpleTestCase): ) self.assertEqual( output, - '<a href="http://example.com/?x=&y=" rel="nofollow">http://example.com/?x=&y=</a> ' - '<a href="http://example.com?x=&y=%3C2%3E" rel="nofollow">http://example.com?x=&y=<2></a>' + '<a href="http://example.com/?x=&y=" rel="nofollow">http://example.com/?x=&y=</a> ' + '<a href="http://example.com?x=&y=%3C2%3E" rel="nofollow">http://example.com?x=&y=<2></a>' ) @setup({'urlize02': '{{ a|urlize }} {{ b|urlize }}'}) @@ -30,8 +30,8 @@ class UrlizeTests(SimpleTestCase): ) self.assertEqual( output, - '<a href="http://example.com/?x=&y=" rel="nofollow">http://example.com/?x=&y=</a> ' - '<a href="http://example.com?x=&y=" rel="nofollow">http://example.com?x=&y=</a>' + '<a href="http://example.com/?x=&y=" rel="nofollow">http://example.com/?x=&y=</a> ' + '<a href="http://example.com?x=&y=" rel="nofollow">http://example.com?x=&y=</a>' ) @setup({'urlize03': '{% autoescape off %}{{ a|urlize }}{% endautoescape %}'}) @@ -78,7 +78,7 @@ class UrlizeTests(SimpleTestCase): output = self.engine.render_to_string('urlize09', {'a': "http://example.com/?x=&y=<2>"}) self.assertEqual( output, - '<a href="http://example.com/?x=&y=%3C2%3E" rel="nofollow">http://example.com/?x=&y=<2></a>', + '<a href="http://example.com/?x=&y=%3C2%3E" rel="nofollow">http://example.com/?x=&y=<2></a>', ) diff --git a/tests/template_tests/filter_tests/test_urlizetrunc.py b/tests/template_tests/filter_tests/test_urlizetrunc.py index 2b4b18e1f5..cb5c2a6daf 100644 --- a/tests/template_tests/filter_tests/test_urlizetrunc.py +++ b/tests/template_tests/filter_tests/test_urlizetrunc.py @@ -19,8 +19,8 @@ class UrlizetruncTests(SimpleTestCase): ) self.assertEqual( output, - '"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> ' - '"Safe" <a href="http://example.com?x=&y=" rel="nofollow">http:...</a>' + '"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> ' + '"Safe" <a href="http://example.com?x=&y=" rel="nofollow">http:...</a>' ) @setup({'urlizetrunc02': '{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}'}) @@ -34,8 +34,8 @@ class UrlizetruncTests(SimpleTestCase): ) self.assertEqual( output, - '"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> ' - '"Safe" <a href="http://example.com?x=&y=" rel="nofollow">http:...</a>' + '"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> ' + '"Safe" <a href="http://example.com?x=&y=" rel="nofollow">http:...</a>' ) @@ -72,7 +72,7 @@ class FunctionTests(SimpleTestCase): def test_query_string(self): self.assertEqual( urlizetrunc('http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&meta=', 20), - '<a href="http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&' + '<a href="http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&' 'meta=" rel="nofollow">http://www.google...</a>', ) |
