mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #7651: uploading multiple files with the same name now work. Also, in order to test the problem the test client now handles uploading multiple files at once. Patch from Mike Axiak.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -147,12 +147,35 @@ class FileUploadTests(TestCase):
|
||||
def test_broken_custom_upload_handler(self):
|
||||
f = tempfile.NamedTemporaryFile()
|
||||
f.write('a' * (2 ** 21))
|
||||
|
||||
|
||||
# AttributeError: You cannot alter upload handlers after the upload has been processed.
|
||||
self.assertRaises(
|
||||
AttributeError,
|
||||
self.client.post,
|
||||
'/file_uploads/quota/broken/',
|
||||
'/file_uploads/quota/broken/',
|
||||
{'f': open(f.name)}
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
def test_fileupload_getlist(self):
|
||||
file1 = tempfile.NamedTemporaryFile()
|
||||
file1.write('a' * (2 ** 23))
|
||||
|
||||
file2 = tempfile.NamedTemporaryFile()
|
||||
file2.write('a' * (2 * 2 ** 18))
|
||||
|
||||
file2a = tempfile.NamedTemporaryFile()
|
||||
file2a.write('a' * (5 * 2 ** 20))
|
||||
|
||||
response = self.client.post('/file_uploads/getlist_count/', {
|
||||
'file1': open(file1.name),
|
||||
'field1': u'test',
|
||||
'field2': u'test3',
|
||||
'field3': u'test5',
|
||||
'field4': u'test6',
|
||||
'field5': u'test7',
|
||||
'file2': (open(file2.name), open(file2a.name))
|
||||
})
|
||||
got = simplejson.loads(response.content)
|
||||
|
||||
self.assertEqual(got.get('file1'), 1)
|
||||
self.assertEqual(got.get('file2'), 2)
|
||||
|
||||
Reference in New Issue
Block a user