8000 Add tests · localstack/localstack@e4b1475 · GitHub
[go: up one dir, main page]

Skip to content

Commit e4b1475

Browse files
Add tests
1 parent f64b785 commit e4b1475

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/unit/aws/test_connect.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from unittest.mock import ANY, MagicMock, patch
22

33
import boto3
4+
import botocore
45
import pytest
56

67
from localstack.aws.api import RequestContext
@@ -426,3 +427,16 @@ def echo_request_handler(_: HandlerChain, context: RequestContext, response: Res
426427
clients.lambda_.list_functions()
427428

428429
assert test_params == expected_result
430+
431+
def test_region_override(self):
432+
# Boto has an odd behaviour when using a non-default (any other region than us-east-1) in config
433+
# If the region in arg is non-default, it gives the arg the precedence
434+
# But if the region in arg is default (us-east-1), it gives precedence to one in config
435+
# This test asserts that this behaviour is handled by client factories and always give precedence to arg region
436+
437+
factory = ExternalClientFactory()
438+
439+
config = botocore.config.Config(region_name="eu-north-1")
440+
441+
assert factory(region_name="us-east-1", config=config).s3.meta.region_name == "us-east-1"
442+
assert factory(region_name="us-west-1", config=config).s3.meta.region_name == "us-west-1"

0 commit comments

Comments
 (0)
0