mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Stop populating the notification to sender mapping table when creating a notificaiton.
This commit is contained in:
@@ -12,15 +12,12 @@ from app.models import (
|
||||
KEY_TYPE_NORMAL,
|
||||
PRIORITY,
|
||||
SMS_TYPE,
|
||||
NotificationEmailReplyTo,
|
||||
Notification,
|
||||
NotificationSmsSender
|
||||
Notification
|
||||
)
|
||||
|
||||
from tests.app.db import (
|
||||
create_user,
|
||||
create_reply_to_email,
|
||||
create_service_sms_sender,
|
||||
create_service,
|
||||
create_template
|
||||
)
|
||||
@@ -200,7 +197,7 @@ def test_send_one_off_notification_fails_if_created_by_other_service(sample_temp
|
||||
assert e.value.message == 'Can’t create notification - Test User is not part of the "Sample service" service'
|
||||
|
||||
|
||||
def test_send_one_off_notification_should_add_email_reply_to_id_for_email(sample_email_template, celery_mock):
|
||||
def test_send_one_off_notification_should_add_email_reply_to_text_for_notification(sample_email_template, celery_mock):
|
||||
reply_to_email = create_reply_to_email(sample_email_template.service, 'test@test.com')
|
||||
data = {
|
||||
'to': 'ok@ok.com',
|
||||
@@ -216,8 +213,7 @@ def test_send_one_off_notification_should_add_email_reply_to_id_for_email(sample
|
||||
research_mode=False,
|
||||
queue=None
|
||||
)
|
||||
mapping_row = NotificationEmailReplyTo.query.filter_by(notification_id=notification_id['id']).first()
|
||||
assert mapping_row.service_email_reply_to_id == reply_to_email.id
|
||||
notification.reply_to_text == reply_to_email.email_address
|
||||
|
||||
|
||||
def test_send_one_off_notification_should_throw_exception_if_reply_to_id_doesnot_exist(
|
||||
@@ -234,26 +230,6 @@ def test_send_one_off_notification_should_throw_exception_if_reply_to_id_doesnot
|
||||
send_one_off_notification(service_id=sample_email_template.service.id, post_data=data)
|
||||
|
||||
|
||||
def test_send_one_off_notification_should_add_sms_sender_mapping_for_sms(sample_template, celery_mock):
|
||||
sms_sender = create_service_sms_sender(service=sample_template.service, sms_sender='123456')
|
||||
data = {
|
||||
'to': '07700 900 001',
|
||||
'template_id': str(sample_template.id),
|
||||
'sender_id': sms_sender.id,
|
||||
'created_by': str(sample_template.service.created_by_id)
|
||||
}
|
||||
|
||||
notification_id = send_one_off_notification(service_id=sample_template.service.id, post_data=data)
|
||||
notification = Notification.query.get(notification_id['id'])
|
||||
celery_mock.assert_called_once_with(
|
||||
notification=notification,
|
||||
research_mode=False,
|
||||
queue=None
|
||||
)
|
||||
mapping_row = NotificationSmsSender.query.filter_by(notification_id=notification_id['id']).first()
|
||||
assert mapping_row.service_sms_sender_id == sms_sender.id
|
||||
|
||||
|
||||
def test_send_one_off_notification_should_throw_exception_if_sms_sender_id_doesnot_exist(
|
||||
sample_template
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user