fix idempotency on verify_email_identity endpoint (#5043)

This commit is contained in:
Guriido 2022-04-21 20:27:12 +09:00 committed by GitHub
parent 27e469d95e
commit e63fc08db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -132,7 +132,8 @@ class SESBackend(BaseBackend):
def verify_email_identity(self, address):
_, address = parseaddr(address)
self.addresses.append(address)
if address not in self.addresses:
self.addresses.append(address)
def verify_email_address(self, address):
_, address = parseaddr(address)

View File

@ -22,6 +22,18 @@ def test_verify_email_identity():
address.should.equal("test@example.com")
@mock_ses
def test_verify_email_identity_idempotency():
conn = boto3.client("ses", region_name="us-east-1")
address = "test@example.com"
conn.verify_email_identity(EmailAddress=address)
conn.verify_email_identity(EmailAddress=address)
identities = conn.list_identities()
address_list = identities["Identities"]
address_list.should.equal([address])
@mock_ses
def test_verify_email_address():
conn = boto3.client("ses", region_name="us-east-1")