@@ -16749,6 +16749,25 @@ def _test_copy_part_enc(file_size, source_mode_key, dest_mode_key, source_sc=Non
1674916749 'PartNumber': 2
1675016750 })
1675116751
16752+ if dest_mode_key == 'sse-c':
16753+ # make sure api is verifying the SSE-C headers
16754+ e = assert_raises(ClientError, client.complete_multipart_upload,
16755+ Bucket=dest_bucket_name, Key='testobj2',
16756+ UploadId=upload_id, MultipartUpload={'Parts': parts})
16757+ status, _ = _get_status_and_error_code(e.response)
16758+ assert status == 400
16759+
16760+ # and the key would be the same as the one used in upload part
16761+ # use the source key to complete the upload
16762+ # this is not allowed, so we expect an error
16763+ source_sse_c_args = _copy_enc_source_modes['sse-c']['args']
16764+ e = assert_raises(ClientError, client.complete_multipart_upload,
16765+ Bucket=dest_bucket_name, Key='testobj2',
16766+ UploadId=upload_id, MultipartUpload={'Parts': parts},
16767+ **source_sse_c_args)
16768+ status, _ = _get_status_and_error_code(e.response)
16769+ assert status == 400
16770+
1675216771 # complete the multipart upload
1675316772 response = client.complete_multipart_upload(
1675416773 Bucket=dest_bucket_name,
@@ -16758,6 +16777,7 @@ def _test_copy_part_enc(file_size, source_mode_key, dest_mode_key, source_sc=Non
1675816777 **complete_args
1675916778 )
1676016779 assert dest_args.get('assert', lambda r: True)(response)
16780+
1676116781 # verify the copy is encrypted
1676216782 get_args = dest_args.get('get_args', {})
1676316783 response = client.get_object(Bucket=dest_bucket_name, Key='testobj2', **get_args)
0 commit comments