Merge pull request #1 from attili/master
Corrected test and multipart size check
This commit is contained in:
commit
92bebbb3a1
@ -60,16 +60,15 @@ 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():
|
||||
if part.name != last_part_name and len(part.value) < 5242880:
|
||||
return
|
||||
total.extend(part.value)
|
||||
|
||||
if len(total) < 5242880:
|
||||
return
|
||||
|
||||
return total
|
||||
|
||||
def set_part(self, part_id, value):
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user