Added more tests for django.utils.html.urlize().

This commit is contained in:
Tim Graham 2018-02-27 11:00:47 -05:00
parent 97b7dd59bb
commit 911af0d24b
1 changed files with 6 additions and 0 deletions

View File

@ -249,6 +249,7 @@ class TestUtilsHtml(SimpleTestCase):
lazystr('Search for google.com/?q=!'), lazystr('Search for google.com/?q=!'),
'Search for <a href="http://google.com/?q=">google.com/?q=</a>!' 'Search for <a href="http://google.com/?q=">google.com/?q=</a>!'
), ),
('foo@example.com', '<a href="mailto:foo@example.com">foo@example.com</a>'),
) )
for value, output in tests: for value, output in tests:
with self.subTest(value=value): with self.subTest(value=value):
@ -258,6 +259,11 @@ class TestUtilsHtml(SimpleTestCase):
tests = ( tests = (
('a' + '@a' * 50000) + 'a', # simple_email_re catastrophic test ('a' + '@a' * 50000) + 'a', # simple_email_re catastrophic test
('a' + '.' * 1000000) + 'a', # trailing_punctuation catastrophic test ('a' + '.' * 1000000) + 'a', # trailing_punctuation catastrophic test
'foo@',
'@foo.com',
'foo@.example.com',
'foo@localhost',
'foo@localhost.',
) )
for value in tests: for value in tests:
with self.subTest(value=value): with self.subTest(value=value):