summaryrefslogtreecommitdiff
path: root/tests/validators
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-12-21 00:15:39 +0100
committerClaude Paroz <claude@2xlibre.net>2013-12-28 21:25:32 +0100
commit6d66ba59488bbd0d4f0c2f32b2921f1512301143 (patch)
tree5456bc8cee41877c0340cf4da1151e2ee5bf7695 /tests/validators
parent9f13c3328199d2fa70235cdc63bb06b1efc5b117 (diff)
Fixed #21242 -- Allowed more IANA schemes in URLValidator
Thanks Sascha Peilicke for the report and initial patch, and Tim Graham for the review.
Diffstat (limited to 'tests/validators')
-rw-r--r--tests/validators/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index b0d1376aee..23fa1e3830 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -18,6 +18,7 @@ from django.test.utils import str_prefix
NOW = datetime.now()
+EXTENDED_SCHEMES = ['http', 'https', 'ftp', 'ftps', 'git', 'file']
TEST_DATA = (
# (validator, value, expected),
@@ -141,6 +142,7 @@ TEST_DATA = (
(MinLengthValidator(10), '', ValidationError),
(URLValidator(), 'http://www.djangoproject.com/', None),
+ (URLValidator(), 'HTTP://WWW.DJANGOPROJECT.COM/', None),
(URLValidator(), 'http://localhost/', None),
(URLValidator(), 'http://example.com/', None),
(URLValidator(), 'http://www.example.com/', None),
@@ -155,6 +157,8 @@ TEST_DATA = (
(URLValidator(), 'https://example.com/', None),
(URLValidator(), 'ftp://example.com/', None),
(URLValidator(), 'ftps://example.com/', None),
+ (URLValidator(EXTENDED_SCHEMES), 'file://localhost/path', None),
+ (URLValidator(EXTENDED_SCHEMES), 'git://example.com/', None),
(URLValidator(), 'foo', ValidationError),
(URLValidator(), 'http://', ValidationError),
@@ -165,6 +169,9 @@ TEST_DATA = (
(URLValidator(), 'http://-invalid.com', ValidationError),
(URLValidator(), 'http://inv-.alid-.com', ValidationError),
(URLValidator(), 'http://inv-.-alid.com', ValidationError),
+ (URLValidator(), 'file://localhost/path', ValidationError),
+ (URLValidator(), 'git://example.com/', ValidationError),
+ (URLValidator(EXTENDED_SCHEMES), 'git://-invalid.com', ValidationError),
(BaseValidator(True), True, None),
(BaseValidator(True), False, ValidationError),