SES domains are case-insensitive (#4050)

This commit is contained in:
Brian Pandola 2021-07-01 21:28:41 -07:00 committed by GitHub
parent 3ae4c23c23
commit 7147c5f05a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -137,7 +137,8 @@ class SESBackend(BaseBackend):
self.email_addresses.append(address)
def verify_domain(self, domain):
self.domains.append(domain)
if domain.lower() not in self.domains:
self.domains.append(domain.lower())
def list_identities(self):
return self.domains + self.addresses

View File

@ -8,7 +8,7 @@ from six.moves.email_mime_text import MIMEText
import pytest
# import sure # noqa
import sure # noqa
from moto import mock_ses
@ -598,3 +598,19 @@ def test_update_ses_template():
result["Template"]["HtmlPart"].should.equal(
"<h1>Hello {{name}},</h1><p>Your favorite color is {{color}}</p>"
)
@mock_ses
def test_domains_are_case_insensitive():
client = boto3.client("ses", region_name="us-east-1")
duplicate_domains = [
"EXAMPLE.COM",
"EXAMple.Com",
"example.com",
]
for domain in duplicate_domains:
client.verify_domain_identity(Domain=domain)
client.verify_domain_dkim(Domain=domain)
identities = client.list_identities(IdentityType="Domain")["Identities"]
identities.should.have.length_of(1)
identities[0].should.equal("example.com")