diff options
| author | Justin Bronn <jbronn@gmail.com> | 2008-01-28 15:35:46 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2008-01-28 15:35:46 +0000 |
| commit | 00292ad02ebf9ff1cb09d586c2452b3a716fd601 (patch) | |
| tree | 2ffd3546659f49b2eed2626ab5cfdf508ba69fbf /tests/regressiontests/forms/fields.py | |
| parent | 398eca3fb2ac84304b179fabd2f0960228c59b09 (diff) | |
gis: Merged revisions 6990-7043 via svnmerge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/fields.py')
| -rw-r--r-- | tests/regressiontests/forms/fields.py | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py index cff5db6fca..9216210e09 100644 --- a/tests/regressiontests/forms/fields.py +++ b/tests/regressiontests/forms/fields.py @@ -749,32 +749,59 @@ Traceback (most recent call last): ... ValidationError: [u'This field is required.'] +>>> f.clean('', '') +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] + +>>> f.clean('', 'files/test1.pdf') +'files/test1.pdf' + >>> f.clean(None) Traceback (most recent call last): ... ValidationError: [u'This field is required.'] +>>> f.clean(None, '') +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] + +>>> f.clean(None, 'files/test2.pdf') +'files/test2.pdf' + >>> f.clean({}) Traceback (most recent call last): ... ValidationError: [u'No file was submitted.'] +>>> f.clean({}, '') +Traceback (most recent call last): +... +ValidationError: [u'No file was submitted.'] + +>>> f.clean({}, 'files/test3.pdf') +'files/test3.pdf' + >>> f.clean('some content that is not a file') Traceback (most recent call last): ... ValidationError: [u'No file was submitted. Check the encoding type on the form.'] ->>> f.clean({'filename': 'name', 'content':None}) +>>> f.clean({'filename': 'name', 'content': None}) Traceback (most recent call last): ... ValidationError: [u'The submitted file is empty.'] ->>> f.clean({'filename': 'name', 'content':''}) +>>> f.clean({'filename': 'name', 'content': ''}) Traceback (most recent call last): ... ValidationError: [u'The submitted file is empty.'] ->>> type(f.clean({'filename': 'name', 'content':'Some File Content'})) +>>> type(f.clean({'filename': 'name', 'content': 'Some File Content'})) +<class 'django.newforms.fields.UploadedFile'> + +>>> type(f.clean({'filename': 'name', 'content': 'Some File Content'}, 'files/test4.pdf')) <class 'django.newforms.fields.UploadedFile'> # URLField ################################################################## |
