From 7f49adda30c2b68c7bb94c823f0522c0c91d8e96 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 26 Feb 2019 16:25:28 -0500 Subject: [PATCH] boto3: _get_post_url() uses config endpoint Signed-off-by: Casey Bodley --- s3tests_boto3/functional/__init__.py | 3 +++ s3tests_boto3/functional/test_s3.py | 15 +++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/s3tests_boto3/functional/__init__.py b/s3tests_boto3/functional/__init__.py index 54bf0d1..78109ac 100644 --- a/s3tests_boto3/functional/__init__.py +++ b/s3tests_boto3/functional/__init__.py @@ -339,6 +339,9 @@ def get_config_host(): def get_config_port(): return config.default_port +def get_config_endpoint(): + return config.default_endpoint + def get_main_aws_access_key(): return config.main_access_key diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 13fb300..3038a84 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -50,6 +50,7 @@ from . import ( get_config_is_secure, get_config_host, get_config_port, + get_config_endpoint, get_main_aws_access_key, get_main_aws_secret_key, get_main_display_name, @@ -1360,18 +1361,8 @@ def test_object_write_file(): eq(body, 'bar') def _get_post_url(bucket_name): - protocol='http' - is_secure = get_config_is_secure() - - if is_secure is True: - protocol='https' - - host = get_config_host() - port = get_config_port() - - url = '{protocol}://{host}:{port}/{bucket_name}'.format(protocol=protocol,\ - host=host, port=port, bucket_name=bucket_name) - return url + endpoint = get_config_endpoint() + return '{endpoint}/{bucket_name}'.format(endpoint=endpoint, bucket_name=bucket_name) @attr(resource='object') @attr(method='post')