SES: Ensure service is region-aware (#5862)
This commit is contained in:
parent
c81bd9a1aa
commit
90e63c1cb5
@ -115,7 +115,7 @@ class SESBackend(BaseBackend):
|
||||
|
||||
from moto.core import DEFAULT_ACCOUNT_ID
|
||||
from moto.ses import ses_backends
|
||||
ses_backend = ses_backends[DEFAULT_ACCOUNT_ID]["global"]
|
||||
ses_backend = ses_backends[DEFAULT_ACCOUNT_ID][region]
|
||||
messages = ses_backend.sent_messages # sent_messages is a List of Message objects
|
||||
|
||||
Note that, as this is an internal API, the exact format may differ per versions.
|
||||
@ -585,6 +585,4 @@ class SESBackend(BaseBackend):
|
||||
return attributes_by_identity
|
||||
|
||||
|
||||
ses_backends: Mapping[str, SESBackend] = BackendDict(
|
||||
SESBackend, "ses", use_boto3_regions=False, additional_regions=["global"]
|
||||
)
|
||||
ses_backends: Mapping[str, SESBackend] = BackendDict(SESBackend, "ses")
|
||||
|
@ -11,7 +11,7 @@ class EmailResponse(BaseResponse):
|
||||
|
||||
@property
|
||||
def backend(self):
|
||||
return ses_backends[self.current_account]["global"]
|
||||
return ses_backends[self.current_account][self.region]
|
||||
|
||||
def verify_email_identity(self):
|
||||
address = self.querystring.get("EmailAddress")[0]
|
||||
|
@ -19,6 +19,15 @@ def test_verify_email_identity():
|
||||
address.should.equal("test@example.com")
|
||||
|
||||
|
||||
@mock_ses
|
||||
def test_identities_are_region_specific():
|
||||
us_east = boto3.client("ses", region_name="us-east-1")
|
||||
us_east.verify_email_identity(EmailAddress="test@example.com")
|
||||
|
||||
us_west = boto3.client("ses", region_name="us-west-1")
|
||||
us_west.list_identities()["Identities"].should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ses
|
||||
def test_verify_email_identity_idempotency():
|
||||
conn = boto3.client("ses", region_name="us-east-1")
|
||||
|
Loading…
Reference in New Issue
Block a user