Merge pull request #1 from attili/master

Corrected test and multipart size check
This commit is contained in:
Konstantinos Koukopoulos 2013-11-14 05:18:08 -08:00
commit 92bebbb3a1
2 changed files with 4 additions and 5 deletions

View File

@ -60,15 +60,14 @@ class FakeMultipart(object):
self.parts = {}
self.id = base64.b64encode(os.urandom(43)).replace('=', '').replace('+', '')
def complete(self):
total = bytearray()
last_part_name = len(self.list_parts())
for part in self.list_parts():
total.extend(part.value)
if len(total) < 5242880:
if part.name != last_part_name and len(part.value) < 5242880:
return
total.extend(part.value)
return total

View File

@ -47,7 +47,7 @@ def test_multipart_upload():
multipart.upload_part_from_file(BytesIO('hello'), 1)
multipart.upload_part_from_file(BytesIO('world'), 2)
# Multipart with total size under 5MB is refused
multipart.complete_upload().should.throw(S3ResponseError)
multipart.complete_upload.should.throw(S3ResponseError)
multipart = bucket.initiate_multipart_upload("the-key")
part1 = '0' * 5242880