This commit is contained in:
parent
4af57c18bd
commit
4778377e8e
4 changed files with 45 additions and 4 deletions
|
|
@ -2310,7 +2310,12 @@ def test_s3_abort_multipart_data_with_invalid_upload_and_key():
|
|||
client.abort_multipart_upload(
|
||||
Bucket="blah", Key="foobar", UploadId="dummy_upload_id"
|
||||
)
|
||||
err.value.response["Error"]["Code"].should.equal("NoSuchUpload")
|
||||
err = err.value.response["Error"]
|
||||
err["Code"].should.equal("NoSuchUpload")
|
||||
err["Message"].should.equal(
|
||||
"The specified upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed."
|
||||
)
|
||||
err["UploadId"].should.equal("dummy_upload_id")
|
||||
|
||||
|
||||
@mock_s3
|
||||
|
|
|
|||
24
tests/test_s3/test_s3_multipart.py
Normal file
24
tests/test_s3/test_s3_multipart.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from botocore.exceptions import ClientError
|
||||
from moto import mock_s3
|
||||
import boto3
|
||||
import pytest
|
||||
import sure # noqa
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_multipart_should_throw_nosuchupload_if_there_are_no_parts():
|
||||
bucket = boto3.resource("s3").Bucket("randombucketname")
|
||||
bucket.create()
|
||||
s3_object = bucket.Object("my/test2")
|
||||
|
||||
multipart_upload = s3_object.initiate_multipart_upload()
|
||||
multipart_upload.abort()
|
||||
|
||||
with pytest.raises(ClientError) as ex:
|
||||
list(multipart_upload.parts.all())
|
||||
err = ex.value.response["Error"]
|
||||
err["Code"].should.equal("NoSuchUpload")
|
||||
err["Message"].should.equal(
|
||||
"The specified upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed."
|
||||
)
|
||||
err["UploadId"].should.equal(multipart_upload.id)
|
||||
Loading…
Add table
Add a link
Reference in a new issue