Skip to content

Commit

Permalink
Merge pull request #2966 from usmangani1/SES_mod
Browse files Browse the repository at this point in the history
SES get send statistics response modification
  • Loading branch information
bblommers committed May 7, 2020
2 parents ff23489 + dcb1220 commit ed109da
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
30 changes: 16 additions & 14 deletions moto/ses/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,20 +292,22 @@ def create_configuration_set_event_destination(self):
</SetIdentityNotificationTopicResponse>"""

GET_SEND_STATISTICS = """<GetSendStatisticsResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<SendDataPoints>
{% for statistics in all_statistics %}
<item>
<DeliveryAttempts>{{ statistics["DeliveryAttempts"] }}</DeliveryAttempts>
<Rejects>{{ statistics["Rejects"] }}</Rejects>
<Bounces>{{ statistics["Bounces"] }}</Bounces>
<Complaints>{{ statistics["Complaints"] }}</Complaints>
<Timestamp>{{ statistics["Timestamp"] }}</Timestamp>
</item>
{% endfor %}
</SendDataPoints>
<ResponseMetadata>
<RequestId>e0abcdfa-c866-11e0-b6d0-273d09173z49</RequestId>
</ResponseMetadata>
<GetSendStatisticsResult>
<SendDataPoints>
{% for statistics in all_statistics %}
<item>
<DeliveryAttempts>{{ statistics["DeliveryAttempts"] }}</DeliveryAttempts>
<Rejects>{{ statistics["Rejects"] }}</Rejects>
<Bounces>{{ statistics["Bounces"] }}</Bounces>
<Complaints>{{ statistics["Complaints"] }}</Complaints>
<Timestamp>{{ statistics["Timestamp"] }}</Timestamp>
</item>
{% endfor %}
</SendDataPoints>
<ResponseMetadata>
<RequestId>e0abcdfa-c866-11e0-b6d0-273d09173z49</RequestId>
</ResponseMetadata>
</GetSendStatisticsResult>
</GetSendStatisticsResponse>"""

CREATE_CONFIGURATION_SET = """<CreateConfigurationSetResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
Expand Down
16 changes: 12 additions & 4 deletions tests/test_ses/test_ses.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@ def test_get_send_statistics():
result = conn.get_send_statistics()

reject_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["Rejects"]
result["GetSendStatisticsResponse"]["GetSendStatisticsResult"][
"SendDataPoints"
][0]["Rejects"]
)
delivery_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["DeliveryAttempts"]
result["GetSendStatisticsResponse"]["GetSendStatisticsResult"][
"SendDataPoints"
][0]["DeliveryAttempts"]
)
reject_count.should.equal(1)
delivery_count.should.equal(0)
Expand All @@ -162,10 +166,14 @@ def test_get_send_statistics():
result = conn.get_send_statistics()

reject_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["Rejects"]
result["GetSendStatisticsResponse"]["GetSendStatisticsResult"][
"SendDataPoints"
][0]["Rejects"]
)
delivery_count = int(
result["GetSendStatisticsResponse"]["SendDataPoints"][0]["DeliveryAttempts"]
result["GetSendStatisticsResponse"]["GetSendStatisticsResult"][
"SendDataPoints"
][0]["DeliveryAttempts"]
)
reject_count.should.equal(1)
delivery_count.should.equal(1)

0 comments on commit ed109da

Please sign in to comment.