From 19947bd541fcc153380df65b18e717f9cb6f0274 Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Wed, 22 Jan 2020 17:03:10 +0100 Subject: [PATCH] add ability to get svc client for s3config set of apis Signed-off-by: Abhishek Lekshmanan (cherry picked from commit 6d3f574a8ec8e61a2d5591a4c448b5b9e6404598) --- s3tests_boto3/functional/__init__.py | 12 ++++++++++++ s3tests_boto3/functional/test_s3.py | 1 + 2 files changed, 13 insertions(+) diff --git a/s3tests_boto3/functional/__init__.py b/s3tests_boto3/functional/__init__.py index 5d7e3c1..9549276 100644 --- a/s3tests_boto3/functional/__init__.py +++ b/s3tests_boto3/functional/__init__.py @@ -293,6 +293,18 @@ def get_bad_auth_client(aws_access_key_id='badauth'): config=Config(signature_version='s3v4')) return client +def get_svc_client(client_config=None, svc='s3'): + if client_config == None: + client_config = Config(signature_version='s3v4') + + client = boto3.client(service_name=svc, + aws_access_key_id=config.main_access_key, + aws_secret_access_key=config.main_secret_key, + endpoint_url=config.default_endpoint, + use_ssl=config.default_is_secure, + config=client_config) + return client + bucket_counter = itertools.count(1) def get_new_bucket_name(): diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 85751bc..f3bd89c 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -69,6 +69,7 @@ from . import ( get_objects_list, get_main_kms_keyid, get_secondary_kms_keyid, + get_svc_client, nuke_prefixed_buckets, )