Enhancement Adding SES get_send_statistics,create_configuration_set functions

This commit is contained in:
usmankb 2020-05-01 21:16:33 +05:30
commit 440213f854
5 changed files with 202 additions and 1 deletions

View file

@ -4,6 +4,8 @@ import boto3
from botocore.exceptions import ClientError
from six.moves.email_mime_multipart import MIMEMultipart
from six.moves.email_mime_text import MIMEText
from nose.tools import assert_raises
import sure # noqa
@ -227,3 +229,53 @@ def test_send_email_notification_with_encoded_sender():
Message={"Subject": {"Data": "hi",}, "Body": {"Text": {"Data": "there",}}},
)
response["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
@mock_ses
def test_create_configuration_set():
conn = boto3.client("ses", region_name="us-east-1")
conn.create_configuration_set(ConfigurationSet=dict({"Name": "test"}))
conn.create_configuration_set_event_destination(
ConfigurationSetName='test',
EventDestination={
'Name': 'snsEvent',
'Enabled': True,
'MatchingEventTypes': [
'send',
],
'SNSDestination': {
'TopicARN': 'arn:aws:sns:us-east-1:123456789012:myTopic'
}
})
with assert_raises(ClientError) as ex:
conn.create_configuration_set_event_destination(
ConfigurationSetName='failtest',
EventDestination={
'Name': 'snsEvent',
'Enabled': True,
'MatchingEventTypes': [
'send',
],
'SNSDestination': {
'TopicARN': 'arn:aws:sns:us-east-1:123456789012:myTopic'
}
})
ex.exception.response["Error"]["Code"].should.equal("ConfigurationSetDoesNotExist")
with assert_raises(ClientError) as ex:
conn.create_configuration_set_event_destination(
ConfigurationSetName='test',
EventDestination={
'Name': 'snsEvent',
'Enabled': True,
'MatchingEventTypes': [
'send',
],
'SNSDestination': {
'TopicARN': 'arn:aws:sns:us-east-1:123456789012:myTopic'
}
})
ex.exception.response["Error"]["Code"].should.equal("EventDestinationAlreadyExists")