]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Added tests for HEAD method for encrypted objects.
authorAdam Kupczyk <akupczyk@mirantis.com>
Wed, 22 Feb 2017 10:26:28 +0000 (11:26 +0100)
committerCasey Bodley <cbodley@redhat.com>
Tue, 28 Mar 2017 14:03:59 +0000 (10:03 -0400)
Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
s3tests/functional/test_s3.py

index e4e7b65487ce5fee3637d59af0868240fbca96a3..a6ed33ca5ddbfb17e87225e8a76ccfdf39a7c140 100644 (file)
@@ -7588,6 +7588,29 @@ def test_encrypted_transfer_13b():
     _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(method='put')
 @attr(operation='write encrypted with SSE-C and read without SSE-C')
@@ -7975,6 +7998,27 @@ def test_sse_kms_transfer_13b():
     _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(method='put')
 @attr(operation='write encrypted with SSE-KMS and read without SSE-KMS')