SES: Fix GetSendStatistics response template (#4826)
This commit is contained in:
parent
eba0fb8adc
commit
38bf0265c1
@ -431,13 +431,13 @@ GET_SEND_STATISTICS = """<GetSendStatisticsResponse xmlns="http://ses.amazonaws.
|
|||||||
<GetSendStatisticsResult>
|
<GetSendStatisticsResult>
|
||||||
<SendDataPoints>
|
<SendDataPoints>
|
||||||
{% for statistics in all_statistics %}
|
{% for statistics in all_statistics %}
|
||||||
<item>
|
<member>
|
||||||
<DeliveryAttempts>{{ statistics["DeliveryAttempts"] }}</DeliveryAttempts>
|
<DeliveryAttempts>{{ statistics["DeliveryAttempts"] }}</DeliveryAttempts>
|
||||||
<Rejects>{{ statistics["Rejects"] }}</Rejects>
|
<Rejects>{{ statistics["Rejects"] }}</Rejects>
|
||||||
<Bounces>{{ statistics["Bounces"] }}</Bounces>
|
<Bounces>{{ statistics["Bounces"] }}</Bounces>
|
||||||
<Complaints>{{ statistics["Complaints"] }}</Complaints>
|
<Complaints>{{ statistics["Complaints"] }}</Complaints>
|
||||||
<Timestamp>{{ statistics["Timestamp"] }}</Timestamp>
|
<Timestamp>{{ statistics["Timestamp"].isoformat() }}</Timestamp>
|
||||||
</item>
|
</member>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</SendDataPoints>
|
</SendDataPoints>
|
||||||
</GetSendStatisticsResult>
|
</GetSendStatisticsResult>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
import re
|
||||||
|
|
||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
|
|
||||||
import moto.server as server
|
import moto.server as server
|
||||||
@ -13,3 +16,16 @@ def test_ses_list_identities():
|
|||||||
|
|
||||||
res = test_client.get("/?Action=ListIdentities")
|
res = test_client.get("/?Action=ListIdentities")
|
||||||
res.data.should.contain(b"ListIdentitiesResponse")
|
res.data.should.contain(b"ListIdentitiesResponse")
|
||||||
|
|
||||||
|
|
||||||
|
def test_ses_get_send_statistics():
|
||||||
|
backend = server.create_backend_app("ses")
|
||||||
|
test_client = backend.test_client()
|
||||||
|
|
||||||
|
res = test_client.get("/?Action=GetSendStatistics")
|
||||||
|
res.data.should.contain(b"GetSendStatisticsResponse")
|
||||||
|
|
||||||
|
# Timestamps must be in ISO 8601 format
|
||||||
|
groups = re.search("<Timestamp>(.*)</Timestamp>", res.data.decode("utf-8"))
|
||||||
|
timestamp = groups.groups()[0]
|
||||||
|
datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%f")
|
||||||
|
Loading…
Reference in New Issue
Block a user