From 05543b85b1fd762a35e51bab54be426e951ab59a Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Thu, 15 Dec 2016 11:09:36 +0100 Subject: [PATCH] Modified aws kms tests to use config variable kms_keyid Signed-off-by: Adam Kupczyk --- s3tests/functional/__init__.py | 1 + s3tests/functional/test_s3.py | 37 +++++++++++----------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/s3tests/functional/__init__.py b/s3tests/functional/__init__.py index 8fb4845..7a6eaee 100644 --- a/s3tests/functional/__init__.py +++ b/s3tests/functional/__init__.py @@ -318,6 +318,7 @@ def setup(): 'host', 'port', 'is_secure', + 'kms_keyid', ]: try: config[name][var] = cfg.get(section, var) diff --git a/s3tests/functional/test_s3.py b/s3tests/functional/test_s3.py index bf9baa5..e4e7b65 100644 --- a/s3tests/functional/test_s3.py +++ b/s3tests/functional/test_s3.py @@ -8180,14 +8180,15 @@ def test_sse_kms_post_object_authenticated_request(): got = key.get_contents_as_string(headers=get_headers) eq(got, 'bar') -keyid = "d8f40c6d-1c2c-4314-b435-4ef445c6971f" @attr(resource='object') @attr(method='put') @attr(operation='Test SSE-KMS encrypted transfer 1 byte') @attr(assertion='success') @attr('encryption') def test_sse_kms_barb_transfer_1b(): - _test_sse_kms_customer_write(48, key_id = keyid) + if 'kms_keyid' not in config['main']: + raise SkipTest + _test_sse_kms_customer_write(1, key_id = config['main']['kms_keyid']) @attr(resource='object') @@ -8196,7 +8197,9 @@ def test_sse_kms_barb_transfer_1b(): @attr(assertion='success') @attr('encryption') def test_sse_kms_barb_transfer_1kb(): - _test_sse_kms_customer_write(1024, key_id = keyid) + if 'kms_keyid' not in config['main']: + raise SkipTest + _test_sse_kms_customer_write(1024, key_id = config['main']['kms_keyid']) @attr(resource='object') @@ -8205,7 +8208,9 @@ def test_sse_kms_barb_transfer_1kb(): @attr(assertion='success') @attr('encryption') def test_sse_kms_barb_transfer_1MB(): - _test_sse_kms_customer_write(1024*1024, key_id = keyid) + if 'kms_keyid' not in config['main']: + raise SkipTest + _test_sse_kms_customer_write(1024*1024, key_id = config['main']['kms_keyid']) @attr(resource='object') @@ -8214,24 +8219,6 @@ def test_sse_kms_barb_transfer_1MB(): @attr(assertion='success') @attr('encryption') def test_sse_kms_barb_transfer_13b(): - _test_sse_kms_customer_write(13, key_id = keyid) - - -@attr(resource='object') -@attr(method='put') -@attr(operation='data write from file (w/100-Continue)') -@attr(assertion='succeeds and returns written data') -@attr('stress') -def test_object_write_file_prrr(): - # boto Key.set_contents_from_file / .send_file uses Expect: - # 100-Continue, so this test exercises that (though a bit too - # subtly) - bucket = get_new_bucket() - for rozmiar in range(1,1000,1): - key = bucket.new_key('plikus') - data = StringIO('bar') - dataarr = [random.randint(0,255) for _ in xrange(rozmiar)] - data = "".join( chr( val ) for val in dataarr ) - key.set_contents_from_string(data) - got = key.get_contents_as_string() - eq(got, data) + if 'kms_keyid' not in config['main']: + raise SkipTest + _test_sse_kms_customer_write(13, key_id = config['main']['kms_keyid'])