mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
fixed code style
This commit is contained in:
@@ -18,7 +18,7 @@ def firetext_post(client, data):
|
||||
data=data,
|
||||
headers=[
|
||||
('Content-Type', 'application/x-www-form-urlencoded'),
|
||||
('X-Forwarded-For', '203.0.113.195, 70.41.3.18, 150.172.238.178') # fake IPs
|
||||
('X-Forwarded-For', '203.0.113.195, 70.41.3.18, 150.172.238.178') # fake IPs
|
||||
])
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ def mmg_post(client, data):
|
||||
data=data,
|
||||
headers=[
|
||||
('Content-Type', 'application/json'),
|
||||
('X-Forwarded-For', '203.0.113.195, 70.41.3.18, 150.172.238.178') # fake IPs
|
||||
('X-Forwarded-For', '203.0.113.195, 70.41.3.18, 150.172.238.178') # fake IPs
|
||||
])
|
||||
|
||||
|
||||
@@ -384,6 +384,7 @@ def test_process_mmg_response_unknown_status_updates_notification_with_failed(
|
||||
assert json_data['result'] == 'success'
|
||||
assert json_data['message'] == 'MMG callback succeeded. reference {} updated'.format(notification.id)
|
||||
assert get_notification_by_id(notification.id).status == 'failed'
|
||||
assert send_mock.called
|
||||
|
||||
|
||||
def test_process_mmg_response_returns_400_for_malformed_data(client):
|
||||
|
||||
@@ -7,21 +7,16 @@ from sqlalchemy.exc import SQLAlchemyError
|
||||
from freezegun import freeze_time
|
||||
from collections import namedtuple
|
||||
|
||||
from app.dao.service_email_reply_to_dao import dao_get_reply_to_by_service_id
|
||||
from app.models import (
|
||||
Notification,
|
||||
NotificationHistory,
|
||||
NotificationEmailReplyTo,
|
||||
NotificationSmsSender,
|
||||
ScheduledNotification,
|
||||
Template
|
||||
)
|
||||
from app.notifications.process_notifications import (
|
||||
create_content_for_notification,
|
||||
persist_notification,
|
||||
persist_email_reply_to_id_for_notification,
|
||||
persist_scheduled_notification,
|
||||
persist_sms_sender_id_for_notification,
|
||||
send_notification_to_queue,
|
||||
simulated_recipient
|
||||
)
|
||||
@@ -29,7 +24,6 @@ from notifications_utils.recipients import validate_and_format_phone_number, val
|
||||
from app.utils import cache_key_for_service_template_counter
|
||||
from app.v2.errors import BadRequestError
|
||||
from tests.app.conftest import sample_api_key as create_api_key
|
||||
from tests.app.db import create_reply_to_email, create_service_sms_sender
|
||||
|
||||
|
||||
def test_create_content_for_notification_passes(sample_email_template):
|
||||
@@ -452,27 +446,3 @@ def test_persist_email_notification_stores_normalised_email(
|
||||
|
||||
assert persisted_notification.to == recipient
|
||||
assert persisted_notification.normalised_to == expected_recipient_normalised
|
||||
|
||||
|
||||
def test_persist_email_reply_to_id_for_notification(sample_service, sample_notification):
|
||||
create_reply_to_email(sample_service, "test@test.com")
|
||||
reply_to_address = dao_get_reply_to_by_service_id(sample_service.id)
|
||||
persist_email_reply_to_id_for_notification(sample_notification.id, reply_to_address[0].id)
|
||||
|
||||
email_reply_to = NotificationEmailReplyTo.query.all()
|
||||
|
||||
assert len(email_reply_to) == 1
|
||||
assert email_reply_to[0].notification_id == sample_notification.id
|
||||
assert email_reply_to[0].service_email_reply_to_id == reply_to_address[0].id
|
||||
|
||||
|
||||
def test_persist_sms_sender_id_for_notification(sample_service, sample_notification):
|
||||
sms_sender = create_service_sms_sender(service=sample_service, sms_sender="123456")
|
||||
persist_sms_sender_id_for_notification(notification_id=sample_notification.id,
|
||||
sms_sender_id=sms_sender.id)
|
||||
|
||||
notification_to_sms_sender = NotificationSmsSender.query.all()
|
||||
|
||||
assert len(notification_to_sms_sender) == 1
|
||||
assert notification_to_sms_sender[0].notification_id == sample_notification.id
|
||||
assert notification_to_sms_sender[0].service_sms_sender_id == sms_sender.id
|
||||
|
||||
Reference in New Issue
Block a user