SES - duplicate boto tests (#4330)
This commit is contained in:
parent
d1e105f2f2
commit
80379312a3
@ -9,6 +9,7 @@ import sure # noqa
|
||||
from moto import mock_ses_deprecated
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_verify_email_identity():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
@ -21,6 +22,7 @@ def test_verify_email_identity():
|
||||
address.should.equal("test@example.com")
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_domain_verify():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
@ -35,6 +37,7 @@ def test_domain_verify():
|
||||
domains.should.equal(["domain1.com", "domain2.com"])
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_delete_identity():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
@ -49,6 +52,7 @@ def test_delete_identity():
|
||||
].should.have.length_of(0)
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_send_email():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
@ -69,6 +73,7 @@ def test_send_email():
|
||||
sent_count.should.equal(1)
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_send_html_email():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
@ -97,6 +102,7 @@ def test_send_html_email():
|
||||
sent_count.should.equal(1)
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_send_raw_email():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
@ -129,6 +135,7 @@ def test_send_raw_email():
|
||||
sent_count.should.equal(1)
|
||||
|
||||
|
||||
# Has boto3 equivalent
|
||||
@mock_ses_deprecated
|
||||
def test_get_send_statistics():
|
||||
conn = boto.connect_ses("the_key", "the_secret")
|
||||
|
@ -614,3 +614,44 @@ def test_domains_are_case_insensitive():
|
||||
identities = client.list_identities(IdentityType="Domain")["Identities"]
|
||||
identities.should.have.length_of(1)
|
||||
identities[0].should.equal("example.com")
|
||||
|
||||
|
||||
@mock_ses
|
||||
def test_get_send_statistics():
|
||||
conn = boto3.client("ses", region_name="us-east-1")
|
||||
|
||||
kwargs = dict(
|
||||
Source="test@example.com",
|
||||
Destination={"ToAddresses": ["test_to@example.com"],},
|
||||
Message={
|
||||
"Subject": {"Data": "test subject"},
|
||||
"Body": {"Html": {"Data": "<span>test body</span>"}},
|
||||
},
|
||||
)
|
||||
with pytest.raises(ClientError) as ex:
|
||||
conn.send_email(**kwargs)
|
||||
err = ex.value.response["Error"]
|
||||
err["Code"].should.equal("MessageRejected")
|
||||
err["Message"].should.equal("Email address not verified test@example.com")
|
||||
|
||||
# tests to verify rejects in get_send_statistics
|
||||
stats = conn.get_send_statistics()["SendDataPoints"]
|
||||
|
||||
stats[0]["Rejects"].should.equal(1)
|
||||
stats[0]["DeliveryAttempts"].should.equal(0)
|
||||
|
||||
conn.verify_email_identity(EmailAddress="test@example.com")
|
||||
conn.send_email(
|
||||
Source="test@example.com",
|
||||
Message={
|
||||
"Subject": {"Data": "test subject"},
|
||||
"Body": {"Text": {"Data": "test body"}},
|
||||
},
|
||||
Destination={"ToAddresses": ["test_to@example.com"],},
|
||||
)
|
||||
|
||||
# tests to delivery attempts in get_send_statistics
|
||||
stats = conn.get_send_statistics()["SendDataPoints"]
|
||||
|
||||
stats[0]["Rejects"].should.equal(1)
|
||||
stats[0]["DeliveryAttempts"].should.equal(1)
|
||||
|
Loading…
Reference in New Issue
Block a user