Skip to content

Commit 881304d

Browse files
committed
Merge pull request #62 from boto/s3-ident-fix
Fix S3 resource identifier order bug
2 parents 28ae6a8 + df4d95b commit 881304d

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

boto3/data/resources/s3-2006-03-01.resources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,8 @@
698698
"type": "MultipartUploadPart",
699699
"identifiers": [
700700
{ "target": "BucketName", "source": "identifier", "name": "BucketName" },
701-
{ "target": "MultipartUploadId", "source": "identifier", "name": "Id" },
702701
{ "target": "ObjectKey", "source": "identifier", "name": "ObjectKey" },
702+
{ "target": "MultipartUploadId", "source": "identifier", "name": "Id" },
703703
{ "target": "PartNumber", "source": "input" }
704704
]
705705
}
@@ -770,8 +770,8 @@
770770
"type": "MultipartUpload",
771771
"identifiers": [
772772
{ "target": "BucketName", "source": "identifier", "name": "BucketName" },
773-
{ "target": "Id", "source": "identifier", "name": "MultipartUploadId" },
774-
{ "target": "ObjectKey", "source": "identifier", "name": "ObjectKey" }
773+
{ "target": "ObjectKey", "source": "identifier", "name": "ObjectKey" },
774+
{ "target": "Id", "source": "identifier", "name": "MultipartUploadId" }
775775
]
776776
}
777777
}

tests/integration/test_s3.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,32 @@ def test_can_create_object_directly(self):
9292

9393
self.assertEqual(obj.bucket_name, self.bucket_name)
9494
self.assertEqual(obj.key, 'test.txt')
95+
96+
def test_s3_multipart(self):
97+
# Create the bucket
98+
bucket = self.create_bucket_resource(self.bucket_name)
99+
bucket.wait_until_exists()
100+
101+
# Create the multipart upload
102+
mpu = bucket.Object('mp-test.txt').initiate_multipart_upload()
103+
self.addCleanup(mpu.abort)
104+
105+
# Create and upload a part
106+
part = mpu.Part(1)
107+
response = part.upload(Body='hello, world!')
108+
109+
# Complete the upload, which requires info on all of the parts
110+
part_info = {
111+
'Parts': [
112+
{
113+
'PartNumber': 1,
114+
'ETag': response['ETag']
115+
}
116+
]
117+
}
118+
119+
mpu.complete(MultipartUpload=part_info)
120+
self.addCleanup(bucket.Object('mp-test.txt').delete)
121+
122+
contents = bucket.Object('mp-test.txt').get()['Body'].read()
123+
self.assertEqual(contents, b'hello, world!')

0 commit comments

Comments
 (0)