add ability to get svc client for s3config set of apis
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 22 Jan 2020 16:03:10 +0000 (17:03 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Wed, 22 Jan 2020 16:03:10 +0000 (17:03 +0100)
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
s3tests_boto3/functional/__init__.py
s3tests_boto3/functional/test_s3.py

index 5d7e3c182647ac1e1550ae30a781889a727472ba..95492765920e0b4fcc3a42823455f25fb2ee6050 100644 (file)
@@ -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():
index 85751bc15fc6cfdf282c49faba840bccdbdf1676..f3bd89c7788529399daa378bfb25d283dbf98432 100644 (file)
@@ -69,6 +69,7 @@ from . import (
     get_objects_list,
     get_main_kms_keyid,
     get_secondary_kms_keyid,
+    get_svc_client,
     nuke_prefixed_buckets,
     )