Added tests for HEAD method for encrypted objects.

Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
(cherry picked from commit b27ddae9c4)
This commit is contained in:
Adam Kupczyk 2017-02-22 11:26:28 +01:00 committed by Casey Bodley
parent 29b11ba39e
commit 5c6658d5ba

View file

@ -7161,6 +7161,29 @@ def test_encrypted_transfer_13b():
_test_encryption_sse_customer_write(13) _test_encryption_sse_customer_write(13)
@attr(resource='object')
@attr(method='head')
@attr(operation='Test SSE-C encrypted does perform head properly')
@attr(assertion='success')
@attr('encryption')
def test_encryption_sse_c_method_head():
bucket = get_new_bucket()
sse_client_headers = {
'x-amz-server-side-encryption-customer-algorithm': 'AES256',
'x-amz-server-side-encryption-customer-key': 'pO3upElrwuEXSoFwCfnZPdSsmt/xWeFa0N9KgDijwVs=',
'x-amz-server-side-encryption-customer-key-md5': 'DWygnHRtgiJ77HCm+1rvHw=='
}
key = bucket.new_key('testobj')
data = 'A'*1000
key.set_contents_from_string(data, headers=sse_client_headers)
res = _make_request('HEAD', bucket, key, authenticated=True)
eq(res.status, 400)
res = _make_request('HEAD', bucket, key, authenticated=True, request_headers=sse_client_headers)
eq(res.status, 200)
@attr(resource='object') @attr(resource='object')
@attr(method='put') @attr(method='put')
@attr(operation='write encrypted with SSE-C and read without SSE-C') @attr(operation='write encrypted with SSE-C and read without SSE-C')
@ -7548,6 +7571,27 @@ def test_sse_kms_transfer_13b():
_test_sse_kms_customer_write(13) _test_sse_kms_customer_write(13)
@attr(resource='object')
@attr(method='head')
@attr(operation='Test SSE-KMS encrypted does perform head properly')
@attr(assertion='success')
@attr('encryption')
def test_sse_kms_method_head():
bucket = get_new_bucket()
sse_kms_client_headers = {
'x-amz-server-side-encryption': 'aws:kms',
'x-amz-server-side-encryption-aws-kms-key-id': 'testkey-1'
}
key = bucket.new_key('testobj')
data = 'A'*1000
key.set_contents_from_string(data, headers=sse_kms_client_headers)
res = _make_request('HEAD', bucket, key, authenticated=True)
eq(res.status, 200)
eq(res.getheader('x-amz-server-side-encryption'), 'aws:kms')
eq(res.getheader('x-amz-server-side-encryption-aws-kms-key-id'), 'testkey-1')
@attr(resource='object') @attr(resource='object')
@attr(method='put') @attr(method='put')
@attr(operation='write encrypted with SSE-KMS and read without SSE-KMS') @attr(operation='write encrypted with SSE-KMS and read without SSE-KMS')