Skip to content

Commit

Permalink
Merge pull request #62 from boto/s3-ident-fix
Browse files Browse the repository at this point in the history
Fix S3 resource identifier order bug
  • Loading branch information
danielgtaylor committed Feb 10, 2015
2 parents 28ae6a8 + df4d95b commit 881304d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
6 changes: 3 additions & 3 deletions boto3/data/resources/s3-2006-03-01.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,8 @@
"type": "MultipartUploadPart",
"identifiers": [
{ "target": "BucketName", "source": "identifier", "name": "BucketName" },
{ "target": "MultipartUploadId", "source": "identifier", "name": "Id" },
{ "target": "ObjectKey", "source": "identifier", "name": "ObjectKey" },
{ "target": "MultipartUploadId", "source": "identifier", "name": "Id" },
{ "target": "PartNumber", "source": "input" }
]
}
Expand Down Expand Up @@ -770,8 +770,8 @@
"type": "MultipartUpload",
"identifiers": [
{ "target": "BucketName", "source": "identifier", "name": "BucketName" },
{ "target": "Id", "source": "identifier", "name": "MultipartUploadId" },
{ "target": "ObjectKey", "source": "identifier", "name": "ObjectKey" }
{ "target": "ObjectKey", "source": "identifier", "name": "ObjectKey" },
{ "target": "Id", "source": "identifier", "name": "MultipartUploadId" }
]
}
}
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,32 @@ def test_can_create_object_directly(self):

self.assertEqual(obj.bucket_name, self.bucket_name)
self.assertEqual(obj.key, 'test.txt')

def test_s3_multipart(self):
# Create the bucket
bucket = self.create_bucket_resource(self.bucket_name)
bucket.wait_until_exists()

# Create the multipart upload
mpu = bucket.Object('mp-test.txt').initiate_multipart_upload()
self.addCleanup(mpu.abort)

# Create and upload a part
part = mpu.Part(1)
response = part.upload(Body='hello, world!')

# Complete the upload, which requires info on all of the parts
part_info = {
'Parts': [
{
'PartNumber': 1,
'ETag': response['ETag']
}
]
}

mpu.complete(MultipartUpload=part_info)
self.addCleanup(bucket.Object('mp-test.txt').delete)

contents = bucket.Object('mp-test.txt').get()['Body'].read()
self.assertEqual(contents, b'hello, world!')

0 comments on commit 881304d

Please sign in to comment.