mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 00:11:16 -05:00
When we cloned the repository and started making modifications, we didn't initially keep tests in step. This commit tries to get us to a clean test run by skipping tests that are failing and removing some that we no longer expect to use (MMG, Firetext), with the intention that we will come back in future and update or remove them as appropriate. To find all tests skipped, search for `@pytest.mark.skip(reason="Needs updating for TTS:`. There will be a brief description of the work that needs to be done to get them passing, if known. Delete that line to make them run in a standard test run (`make test`).
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
import pytest
|
|
|
|
from app import aws_sns_client
|
|
|
|
|
|
def test_send_sms_successful_returns_aws_sns_response(notify_api, mocker):
|
|
boto_mock = mocker.patch.object(aws_sns_client, '_client', create=True)
|
|
mocker.patch.object(aws_sns_client, 'statsd_client', create=True)
|
|
to = "6135555555"
|
|
content = reference = 'foo'
|
|
with notify_api.app_context():
|
|
aws_sns_client.send_sms(to, content, reference)
|
|
boto_mock.publish.assert_called_once_with(
|
|
PhoneNumber="+16135555555",
|
|
Message=content,
|
|
MessageAttributes={'AWS.SNS.SMS.SMSType': {'DataType': 'String', 'StringValue': 'Transactional'}}
|
|
)
|
|
|
|
|
|
def test_send_sms_returns_raises_error_if_there_is_no_valid_number_is_found(notify_api, mocker):
|
|
mocker.patch.object(aws_sns_client, '_client', create=True)
|
|
mocker.patch.object(aws_sns_client, 'statsd_client', create=True)
|
|
to = ""
|
|
content = reference = 'foo'
|
|
with pytest.raises(ValueError) as excinfo:
|
|
aws_sns_client.send_sms(to, content, reference)
|
|
assert 'No valid numbers found for SMS delivery' in str(excinfo.value) |