Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRemis committed Oct 15, 2024
1 parent 23ef82a commit 6f9adef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 0 additions & 4 deletions botocore/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,4 @@ def _compute_sigv4a_signing_region_set(self, config_kwargs):
sigv4a_signing_region_set = self._config_store.get_config_variable(
'sigv4a_signing_region_set'
)
if not sigv4a_signing_region_set:
raise botocore.exceptions.InvalidConfigError(
error_msg="sigv4a_signing_region_set configuration must be non-empty"
)
config_kwargs['sigv4a_signing_region_set'] = sigv4a_signing_region_set
18 changes: 16 additions & 2 deletions tests/functional/test_auth_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
import pytest

from botocore.session import get_session
from tests import create_session, mock

# In the future, a service may have a list of credentials requirements where one
# signature may fail and others may succeed. e.g. a service may want to use bearer
Expand All @@ -31,7 +31,7 @@


def _all_test_cases():
session = get_session()
session = create_session()
loader = session.get_component('data_loader')

services = loader.list_available_services('service-2')
Expand Down Expand Up @@ -75,3 +75,17 @@ def assert_all_requirements_match(auth_config, message):
AUTH_TYPE_REQUIREMENTS[auth_type] for auth_type in auth_config
)
assert len(auth_requirements) == 1


def test_sigv4a_signing_region_set_config_from_environment():
environ = {
'AWS_CONFIG_FILE': 'no-exist-foo',
'AWS_SIGV4A_SIGNING_REGION_SET': 'foo',
}
with mock.patch('os.environ', environ):
session = create_session()
session.config_filename = 'no-exist-foo'
session.create_client('s3')
assert (
session.get_config_variable('sigv4a_signing_region_set') == 'foo'
)

0 comments on commit 6f9adef

Please sign in to comment.