Fix to handle_complaints.

The json we were getting from SES was not quite as expected, the test data now reflects what we get.
New test added, fix a test that was passing regardless.
This commit is contained in:
Rebecca Law
2018-06-06 10:37:31 +01:00
parent c5524a3fe9
commit 4966da8289
4 changed files with 16 additions and 7 deletions

View File

@@ -111,7 +111,6 @@ def remove_emails_from_bounce(bounce_dict):
def handle_complaint(ses_message):
remove_emails_from_complaint(ses_message)
current_app.logger.info("Complaint from SES: \n{}".format(ses_message))
# It is possible that the we get a key error, let this fail so we can investigate.
try:
reference = ses_message['mail']['messageId']
except KeyError as e:
@@ -132,6 +131,7 @@ def handle_complaint(ses_message):
def remove_emails_from_complaint(complaint_dict):
complaint_dict['complaint'].pop('complainedRecipients')
complaint_dict['mail'].pop('destination')
def _check_and_queue_callback_task(notification):