This commit is contained in:
Rebecca Law
2018-06-05 17:23:24 +01:00
parent 64f077f2f4
commit c5524a3fe9
5 changed files with 60 additions and 65 deletions

View File

@@ -201,23 +201,22 @@ def test_remove_emails_from_bounce():
def test_process_ses_results_in_complaint(sample_email_template):
notification = create_notification(template=sample_email_template, reference='ref1')
response = json.loads(ses_complaint_callback())
handle_complaint(response)
handle_complaint(ses_complaint_callback())
complaints = Complaint.query.all()
assert len(complaints) == 1
assert complaints[0].notification_id == notification.id
def test_handle_complaint_does_not_raise_exception_if_reference_is_missing(notify_api):
response = json.loads(ses_complaint_callback_malformed_message_id())
response = json.loads(ses_complaint_callback_malformed_message_id()['Message'])
handle_complaint(response)
assert len(Complaint.query.all()) == 0
def test_process_ses_results_in_complaint_save_complaint_with_null_complaint_type(notify_api, sample_email_template):
notification = create_notification(template=sample_email_template, reference='ref1')
response = json.loads(ses_complaint_callback_with_missing_complaint_type())
handle_complaint(response)
msg = json.loads(ses_complaint_callback_with_missing_complaint_type()['Message'])
handle_complaint(msg)
complaints = Complaint.query.all()
assert len(complaints) == 1
assert complaints[0].notification_id == notification.id