mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Add some useful information to the log.
Fix unit test to actually test the right thing
This commit is contained in:
@@ -2,8 +2,9 @@ import json
|
||||
from datetime import datetime
|
||||
|
||||
from app.celery.process_ses_receipts_tasks import process_ses_results
|
||||
from app.celery.research_mode_tasks import ses_hard_bounce_callback
|
||||
from app.models import Complaint
|
||||
from app.notifications.notifications_ses_callback import remove_emails_from_complaint
|
||||
from app.notifications.notifications_ses_callback import remove_emails_from_complaint, remove_emails_from_bounce
|
||||
|
||||
from tests.app.db import (
|
||||
create_notification, ses_complaint_callback,
|
||||
@@ -51,3 +52,9 @@ def test_remove_emails_from_complaint():
|
||||
test_json = json.loads(ses_complaint_callback()['Message'])
|
||||
remove_emails_from_complaint(test_json)
|
||||
assert "recipient1@example.com" not in json.dumps(test_json)
|
||||
|
||||
|
||||
def test_remove_email_from_bounce():
|
||||
test_json = json.loads(ses_hard_bounce_callback(reference='ref1')['Message'])
|
||||
remove_emails_from_bounce(test_json)
|
||||
assert "bounce@simulator.amazonses.com" not in json.dumps(test_json)
|
||||
|
||||
@@ -9,7 +9,7 @@ from app import statsd_client
|
||||
from app.dao.notifications_dao import get_notification_by_id
|
||||
from app.models import Notification, Complaint
|
||||
from app.notifications.notifications_ses_callback import (
|
||||
process_ses_response, remove_emails_from_bounce,
|
||||
process_ses_response,
|
||||
handle_complaint
|
||||
)
|
||||
from app.celery.research_mode_tasks import ses_hard_bounce_callback, ses_soft_bounce_callback, ses_notification_callback
|
||||
@@ -192,15 +192,6 @@ def test_ses_callback_should_set_status_to_permanent_failure(client,
|
||||
assert send_mock.called
|
||||
|
||||
|
||||
def test_remove_emails_from_bounce():
|
||||
# an actual bouncedict example
|
||||
message_dict = json.loads(ses_hard_bounce_callback(reference='ref')['Message'])
|
||||
|
||||
remove_emails_from_bounce(message_dict['bounce'])
|
||||
|
||||
assert 'not-real@gmail.com' not in json.dumps(message_dict)
|
||||
|
||||
|
||||
def test_process_ses_results_in_complaint(sample_email_template):
|
||||
notification = create_notification(template=sample_email_template, reference='ref1')
|
||||
handle_complaint(json.loads(ses_complaint_callback()['Message']))
|
||||
|
||||
Reference in New Issue
Block a user