Skip to content

Commit

Permalink
Merge pull request #1 from attili/master
Browse files Browse the repository at this point in the history
Corrected test and multipart size check
  • Loading branch information
kouk committed Nov 14, 2013
2 parents b1d59c7 + d9862aa commit 92bebbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions moto/s3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ def __init__(self, key_name):
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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_s3/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92bebbb

Please sign in to comment.