-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart upload support #64
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f557487
Beginning of multipart upload support.
lucian1900 5854219
Upload part and complete upload. Somehow, boto doesn't like output I …
lucian1900 f25caa8
Merge branch 'master' of github.com:spulec/moto
kouk 0b45622
render part upload response correctly
kouk 24ff30f
multipart_id doesn't exist, it's upload_id
kouk 9746e72
implement list parts
kouk 04789a5
don't forget to send the etag in the headers when uploading a part
kouk 3630b3c
remove plus sign from id because it doesn't get parsed correctly in q…
kouk aead9bb
Complete MultiPart Operation does specify a body
kouk 4539012
throw proper error if multipart upload is too small
kouk 8f47355
remove plus from id (for real this time)
kouk e49006c
remove pdb
kouk 6e65b5f
fix part numbering in multipart tests
kouk b1d59c7
support cancelling of multipart upload
kouk b64dbca
Remove ()'s on complete_upload since should.throw requires a 'callable'.
attili d9862aa
Correct size check on multipart uploads. All parts except last must b…
attili 92bebbb
Merge pull request #1 from attili/master
kouk 3628e40
Merge remote-tracking branch 'spulec/master'
kouk bdf5a9e
convert to bytes for python 2.6
kouk 3846c46
replace literal ints with constants
kouk 85e3210
break multipart test in two
kouk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import urllib2 | ||
from io import BytesIO | ||
|
||
import boto | ||
from boto.exception import S3ResponseError | ||
|
@@ -37,6 +38,34 @@ def test_my_model_save(): | |
conn.get_bucket('mybucket').get_key('steve').get_contents_as_string().should.equal('is awesome') | ||
|
||
|
||
@mock_s3 | ||
def test_multipart_upload_too_small(): | ||
conn = boto.connect_s3('the_key', 'the_secret') | ||
bucket = conn.create_bucket("foobar") | ||
|
||
multipart = bucket.initiate_multipart_upload("the-key") | ||
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) | ||
|
||
|
||
@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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a comment about what we're doing here? |
||
multipart.upload_part_from_file(BytesIO(part1), 1) | ||
# last part, can be less than 5 MB | ||
part2 = '1' | ||
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) | ||
|
||
|
||
@mock_s3 | ||
def test_missing_key(): | ||
conn = boto.connect_s3('the_key', 'the_secret') | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to break this second part into a separate test.