diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-04-16 14:25:18 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-04-16 14:25:18 +0000 |
| commit | 6590061a005b8772baee1a94d7799bcb58d9841d (patch) | |
| tree | f3a151c7ebf4a814aab5f68a0028787a658ce79e /tests | |
| parent | 48b459a83e40aa6dae588f114d68f54b95e860de (diff) | |
Fixed #9948 -- Corrected URLField validation to match RFC1035 (URL analog of #9890). Thanks to kratorius for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10574 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/forms/fields.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py index bec07dd5c3..f66f2e1bb5 100644 --- a/tests/regressiontests/forms/fields.py +++ b/tests/regressiontests/forms/fields.py @@ -900,6 +900,10 @@ u'http://example.com/' u'http://www.example.com/' >>> f.clean('http://www.example.com:8000/test') u'http://www.example.com:8000/test' +>>> f.clean('valid-with-hyphens.com') +u'http://valid-with-hyphens.com/' +>>> f.clean('subdomain.domain.com') +u'http://subdomain.domain.com/' >>> f.clean('http://200.8.9.10') u'http://200.8.9.10/' >>> f.clean('http://200.8.9.10:8000/test') @@ -924,6 +928,24 @@ ValidationError: [u'Enter a valid URL.'] Traceback (most recent call last): ... ValidationError: [u'Enter a valid URL.'] +>>> f.clean('http://invalid-.com') +Traceback (most recent call last): +... +ValidationError: [u'Enter a valid URL.'] +>>> f.clean('http://-invalid.com') +Traceback (most recent call last): +... +ValidationError: [u'Enter a valid URL.'] +>>> f.clean('http://inv-.alid-.com') +Traceback (most recent call last): +... +ValidationError: [u'Enter a valid URL.'] +>>> f.clean('http://inv-.-alid.com') +Traceback (most recent call last): +... +ValidationError: [u'Enter a valid URL.'] +>>> f.clean('http://valid-----hyphens.com') +u'http://valid-----hyphens.com/' >>> f = URLField(required=False) >>> f.clean('') |
