Enable AWSLambda and STS mocking for AWS China regions/endpoints (#3574)
Fixes #3570
This commit is contained in:
parent
1a98c4f14a
commit
d712a98ce1
@ -1,7 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
from .responses import LambdaResponse
|
||||
|
||||
url_bases = ["https?://lambda.(.+).amazonaws.com"]
|
||||
url_bases = ["https?://lambda.(.+).amazonaws.com(|.cn)"]
|
||||
|
||||
response = LambdaResponse()
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
from .responses import TokenResponse
|
||||
|
||||
url_bases = ["https?://sts(.*).amazonaws.com"]
|
||||
url_bases = ["https?://sts(.*).amazonaws.com(|.cn)"]
|
||||
|
||||
url_paths = {"{0}/$": TokenResponse.dispatch}
|
||||
|
@ -86,6 +86,14 @@ def lambda_handler(event, context):
|
||||
return _process_lambda(pfunc)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("region", ["us-west-2", "cn-northwest-1"])
|
||||
@mock_lambda
|
||||
def test_lambda_regions(region):
|
||||
client = boto3.client("lambda", region_name=region)
|
||||
resp = client.list_functions()
|
||||
resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||
|
||||
|
||||
@mock_lambda
|
||||
def test_list_functions():
|
||||
conn = boto3.client("lambda", _lambda_region)
|
||||
|
@ -741,3 +741,11 @@ def test_federation_token_with_too_long_policy():
|
||||
ex.value.response["Error"]["Message"].should.contain(
|
||||
str(MAX_FEDERATION_TOKEN_POLICY_LENGTH)
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("region", ["us-west-2", "cn-northwest-1"])
|
||||
@mock_sts
|
||||
def test_sts_regions(region):
|
||||
client = boto3.client("sts", region_name=region)
|
||||
resp = client.get_caller_identity()
|
||||
resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||
|
Loading…
Reference in New Issue
Block a user