From ac71900ffb47793638317116d16d1baf75a95a98 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 25 Sep 2024 13:18:21 +0200 Subject: [PATCH 1/2] Add v2 signature presigned get_object tests This adds tests for get_object presigned URLs using signature v2. Also code formatting. Signed-off-by: Tobias Urdin --- s3tests_boto3/functional/__init__.py | 11 +++++++++++ s3tests_boto3/functional/test_s3.py | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/s3tests_boto3/functional/__init__.py b/s3tests_boto3/functional/__init__.py index 3bdf2ec..7ca874b 100644 --- a/s3tests_boto3/functional/__init__.py +++ b/s3tests_boto3/functional/__init__.py @@ -511,6 +511,17 @@ def get_tenant_client(client_config=None): config=client_config) return client +def get_v2_tenant_client(): + client_config = Config(signature_version='s3') + client = boto3.client(service_name='s3', + aws_access_key_id=config.tenant_access_key, + aws_secret_access_key=config.tenant_secret_key, + endpoint_url=config.default_endpoint, + use_ssl=config.default_is_secure, + verify=config.default_ssl_verify, + config=client_config) + return client + def get_tenant_iam_client(): client = boto3.client(service_name='iam', diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index b73a18b..7d8b095 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -67,6 +67,7 @@ from . import ( get_alt_email, get_alt_client, get_tenant_client, + get_v2_tenant_client, get_tenant_iam_client, get_tenant_name, get_tenant_user_id, @@ -6788,6 +6789,18 @@ def test_cors_presigned_get_object_tenant(): method='get_object', ) +def test_cors_presigned_get_object_v2(): + _test_cors_options_presigned_method( + client=get_v2_client(), + method='get_object', + ) + +def test_cors_presigned_get_object_tenant_v2(): + _test_cors_options_presigned_method( + client=get_v2_tenant_client(), + method='get_object', + ) + def test_cors_presigned_put_object(): _test_cors_options_presigned_method( client=get_client(), From 999d39d4db723554566acf83ccc932cb0a0e832b Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 25 Sep 2024 11:29:01 -0400 Subject: [PATCH 2/2] s3: add v2 signature presigned put_object tests Signed-off-by: Casey Bodley --- s3tests_boto3/functional/test_s3.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 7d8b095..b57a673 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -6814,6 +6814,18 @@ def test_cors_presigned_put_object_with_acl(): cannedACL='private', ) +def test_cors_presigned_put_object_v2(): + _test_cors_options_presigned_method( + client=get_v2_client(), + method='put_object', + ) + +def test_cors_presigned_put_object_tenant_v2(): + _test_cors_options_presigned_method( + client=get_v2_tenant_client(), + method='put_object', + ) + def test_cors_presigned_put_object_tenant(): _test_cors_options_presigned_method( client=get_tenant_client(),