From 85e32102fa75e3ef043e43758f4297bbe148a47c Mon Sep 17 00:00:00 2001 From: Konstantinos Koukopoulos Date: Fri, 15 Nov 2013 11:59:30 +0200 Subject: [PATCH] break multipart test in two --- tests/test_s3/test_s3.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_s3/test_s3.py b/tests/test_s3/test_s3.py index 8cbd489d0..3d9e3f1fb 100644 --- a/tests/test_s3/test_s3.py +++ b/tests/test_s3/test_s3.py @@ -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") @@ -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)