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

@@ -7,7 +7,7 @@ from app.notifications.notifications_ses_callback import remove_emails_from_comp
from tests.app.db import (
create_notification, ses_complaint_callback,
ses_notification_callback
ses_notification_callback,
)
@@ -40,8 +40,7 @@ def test_process_ses_results_retry_called(notify_db, mocker):
def test_process_ses_results_in_complaint(sample_email_template, mocker):
notification = create_notification(template=sample_email_template, reference='ref1')
mocked = mocker.patch("app.dao.notifications_dao.update_notification_status_by_reference")
response = json.loads(ses_complaint_callback())
process_ses_results(response=response)
process_ses_results(response=ses_complaint_callback())
assert mocked.call_count == 0
complaints = Complaint.query.all()
assert len(complaints) == 1
@@ -49,7 +48,6 @@ def test_process_ses_results_in_complaint(sample_email_template, mocker):
def test_remove_emails_from_complaint():
test_message = ses_complaint_callback()
test_json = json.loads(json.loads(test_message)['Message'])
test_json = json.loads(ses_complaint_callback()['Message'])
remove_emails_from_complaint(test_json)
assert "recipient1@example.com" not in test_json