mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-23 09:29:43 -04:00
Added an optional parameter in the form for POST /v2/notifications/sms and /service/<service_id>/send-notification to pass in the SMS sender id.
The send_sms_to_provider still needs to use the SMS sender being passed in to the POST. As part of https://www.pivotaltracker.com/story/show/152106587
This commit is contained in:
@@ -8,19 +8,20 @@ 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 Template, Notification, NotificationHistory, ScheduledNotification, NotificationEmailReplyTo
|
||||
from app.models import Template, Notification, NotificationHistory, ScheduledNotification, NotificationEmailReplyTo, \
|
||||
NotificationSmsSender
|
||||
from app.notifications.process_notifications import (
|
||||
create_content_for_notification,
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
simulated_recipient,
|
||||
persist_scheduled_notification,
|
||||
persist_email_reply_to_id_for_notification)
|
||||
persist_email_reply_to_id_for_notification, persist_sms_sender_id_for_notification)
|
||||
from notifications_utils.recipients import validate_and_format_phone_number, validate_and_format_email_address
|
||||
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
|
||||
from tests.app.db import create_reply_to_email, create_service_sms_sender
|
||||
|
||||
|
||||
def test_create_content_for_notification_passes(sample_email_template):
|
||||
@@ -452,3 +453,15 @@ def test_persist_email_reply_to_id_for_notification(sample_service, sample_notif
|
||||
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