summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Tamlyn <marc.tamlyn@gmail.com>2012-08-18 12:00:52 +0100
committerMarc Tamlyn <marc.tamlyn@gmail.com>2012-08-18 12:08:44 +0100
commitbfa9fc69bf0afae907af0ba3ef2cab8e10a4fa61 (patch)
treeccaf6fd408887376d664d02fab31680b8a834cb2 /tests
parent16ab519f62f4418a8cff143ea92e642ae89bb2cf (diff)
Fixed #18779 -- URLValidator can't validate url with ipv6.
Validation is reasonably 'soft', as for the ipv4. False positives don't matter too much here.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/forms/tests/fields.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py
index feb2ade458..6efdb9682f 100644
--- a/tests/regressiontests/forms/tests/fields.py
+++ b/tests/regressiontests/forms/tests/fields.py
@@ -668,6 +668,18 @@ class FieldsTests(SimpleTestCase):
# Valid IDN
self.assertEqual(url, f.clean(url))
+ def test_urlfield_10(self):
+ """Test URLField correctly validates IPv6 (#18779)."""
+ f = URLField()
+ urls = (
+ 'http://::/',
+ 'http://6:21b4:92/',
+ 'http://[12:34:3a53]/',
+ 'http://[a34:9238::]:8080/',
+ )
+ for url in urls:
+ self.assertEqual(url, f.clean(url))
+
def test_urlfield_not_string(self):
f = URLField(required=False)
self.assertRaisesMessage(ValidationError, "'Enter a valid URL.'", f.clean, 23)