diff --git a/tests/functional/configured_endpoint_urls/profile-tests.json b/tests/functional/configured_endpoint_urls/profile-tests.json index 153df73848..5681edc1fa 100644 --- a/tests/functional/configured_endpoint_urls/profile-tests.json +++ b/tests/functional/configured_endpoint_urls/profile-tests.json @@ -73,6 +73,13 @@ "default": {}, "endpoint_url_provided":{ "endpoint_url": "https://client-config.endpoint.aws" + }, + "ignore_configured_endpoint_urls": { + "ignore_configured_endpoint_urls": true + }, + "provide_and_ignore_configured_endpoint_urls": { + "ignore_configured_endpoint_urls": true, + "endpoint_url": "https://client-config.endpoint.aws" } }, @@ -431,6 +438,16 @@ "endpointUrl": "https://s3.fake-region-10.amazonaws.com" } }, + { + "name": "All configured endpoints ignored due to ignore client config parameter.", + "profile": "global_and_service_specific_s3", + "client_config": "ignore_configured_endpoint_urls", + "environment": "global_and_service_specific_s3", + "service": "s3", + "output": { + "endpointUrl": "https://s3.fake-region-10.amazonaws.com" + } + }, { "name": "Environment variable and shared config file configured endpoints ignored due to ignore shared config variable and client configured endpoint is used.", "profile": "ignore_global_and_service_specific_s3", @@ -451,6 +468,16 @@ "endpointUrl": "https://client-config.endpoint.aws" } }, + { + "name": "Environment variable and shared config file configured endpoints ignored due to ignore client config variable and client configured endpoint is used.", + "profile": "global_and_service_specific_s3", + "client_config": "provide_and_ignore_configured_endpoint_urls", + "environment": "global_and_service_specific_s3", + "service": "s3", + "output": { + "endpointUrl": "https://client-config.endpoint.aws" + } + }, { "name": "DynamoDB service-specific endpoint url shared config variable is used when service-specific S3 shared config variable is also present.", "profile": "service_specific_dynamodb_and_s3", diff --git a/tests/functional/configured_endpoint_urls/test_configured_endpoint_url.py b/tests/functional/configured_endpoint_urls/test_configured_endpoint_url.py index c29a8f9357..8781e2cb79 100644 --- a/tests/functional/configured_endpoint_urls/test_configured_endpoint_url.py +++ b/tests/functional/configured_endpoint_urls/test_configured_endpoint_url.py @@ -20,6 +20,7 @@ import botocore.configprovider import botocore.utils from botocore.compat import urlsplit +from botocore.config import Config from tests import ClientHTTPStubber ENDPOINT_TESTDATA_FILE = Path(__file__).parent / "profile-tests.json" @@ -49,8 +50,10 @@ def create_cases(): 'expected_endpoint_url': test_case_data['output'][ 'endpointUrl' ], - 'client_args': test_suite['client_configs'].get( - test_case_data['client_config'], {} + 'client_args': get_create_client_args( + test_suite['client_configs'].get( + test_case_data['client_config'], {} + ) ), 'config_file_contents': get_config_file_contents( test_case_data['profile'], test_suite @@ -63,6 +66,24 @@ def create_cases(): ) +def get_create_client_args(test_case_client_config): + create_client_args = {} + + if 'endpoint_url' in test_case_client_config: + create_client_args['endpoint_url'] = test_case_client_config[ + 'endpoint_url' + ] + + if 'ignore_configured_endpoint_urls' in test_case_client_config: + create_client_args['config'] = Config( + ignore_configured_endpoint_urls=test_case_client_config[ + 'ignore_configured_endpoint_urls' + ] + ) + + return create_client_args + + def get_config_file_contents(profile_name, test_suite): profile = test_suite['profiles'][profile_name]