This commit is contained in:
Bert Blommers 2020-05-04 09:24:46 +01:00
commit 353bc08ac2
5 changed files with 81 additions and 58 deletions

View file

@ -144,8 +144,12 @@ def test_get_send_statistics():
# tests to verify rejects in get_send_statistics
result = conn.get_send_statistics()
reject_count = int(result["GetSendStatisticsResponse"]["SendDataPoints"][0]["Rejects"])
delivery_count = int(result["GetSendStatisticsResponse"]["SendDataPoints"][0]["DeliveryAttempts"])
reject_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["Rejects"]
)
delivery_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["DeliveryAttempts"]
)
reject_count.should.equal(1)
delivery_count.should.equal(0)
@ -157,9 +161,11 @@ def test_get_send_statistics():
# tests to delivery attempts in get_send_statistics
result = conn.get_send_statistics()
reject_count = int(result["GetSendStatisticsResponse"]["SendDataPoints"][0]["Rejects"])
delivery_count = int(result["GetSendStatisticsResponse"]["SendDataPoints"][0]["DeliveryAttempts"])
reject_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["Rejects"]
)
delivery_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["DeliveryAttempts"]
)
reject_count.should.equal(1)
delivery_count.should.equal(1)

View file

@ -230,52 +230,50 @@ def test_send_email_notification_with_encoded_sender():
)
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'
}
})
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',
ConfigurationSetName="failtest",
EventDestination={
'Name': 'snsEvent',
'Enabled': True,
'MatchingEventTypes': [
'send',
],
'SNSDestination': {
'TopicARN': 'arn:aws:sns:us-east-1:123456789012:myTopic'
}
})
"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',
ConfigurationSetName="test",
EventDestination={
'Name': 'snsEvent',
'Enabled': True,
'MatchingEventTypes': [
'send',
],
'SNSDestination': {
'TopicARN': 'arn:aws:sns:us-east-1:123456789012:myTopic'
}
})
"Name": "snsEvent",
"Enabled": True,
"MatchingEventTypes": ["send",],
"SNSDestination": {
"TopicARN": "arn:aws:sns:us-east-1:123456789012:myTopic"
},
},
)
ex.exception.response["Error"]["Code"].should.equal("EventDestinationAlreadyExists")
ex.exception.response["Error"]["Code"].should.equal("EventDestinationAlreadyExists")