SES domains are case-insensitive (#4050)
This commit is contained in:
parent
3ae4c23c23
commit
7147c5f05a
@ -137,7 +137,8 @@ class SESBackend(BaseBackend):
|
|||||||
self.email_addresses.append(address)
|
self.email_addresses.append(address)
|
||||||
|
|
||||||
def verify_domain(self, domain):
|
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):
|
def list_identities(self):
|
||||||
return self.domains + self.addresses
|
return self.domains + self.addresses
|
||||||
|
@ -8,7 +8,7 @@ from six.moves.email_mime_text import MIMEText
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
# import sure # noqa
|
import sure # noqa
|
||||||
|
|
||||||
from moto import mock_ses
|
from moto import mock_ses
|
||||||
|
|
||||||
@ -598,3 +598,19 @@ def test_update_ses_template():
|
|||||||
result["Template"]["HtmlPart"].should.equal(
|
result["Template"]["HtmlPart"].should.equal(
|
||||||
"<h1>Hello {{name}},</h1><p>Your favorite color is {{color}}</p>"
|
"<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")
|
||||||
|
Loading…
Reference in New Issue
Block a user