Skip to content

Commit

Permalink
break multipart test in two
Browse files Browse the repository at this point in the history
  • Loading branch information
kouk committed Nov 15, 2013
1 parent 3846c46 commit 85e3210
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_s3/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_my_model_save():


@mock_s3
def test_multipart_upload():
def test_multipart_upload_too_small():
conn = boto.connect_s3('the_key', 'the_secret')
bucket = conn.create_bucket("foobar")

Expand All @@ -49,12 +49,20 @@ def test_multipart_upload():
# Multipart with total size under 5MB is refused
multipart.complete_upload.should.throw(S3ResponseError)


@mock_s3
def test_multipart_upload():
conn = boto.connect_s3('the_key', 'the_secret')
bucket = conn.create_bucket("foobar")

multipart = bucket.initiate_multipart_upload("the-key")
part1 = '0' * 5242880
multipart.upload_part_from_file(BytesIO('0' * 5242880), 1)
multipart.upload_part_from_file(BytesIO(part1), 1)
# last part, can be less than 5 MB
part2 = '1'
multipart.upload_part_from_file(BytesIO('1'), 2)
multipart.upload_part_from_file(BytesIO(part2), 2)
multipart.complete_upload()
# we should get both parts as the key contents
bucket.get_key("the-key").get_contents_as_string().should.equal(part1 + part2)


Expand Down

0 comments on commit 85e3210

Please sign in to comment.