This commit is contained in:
Kenneth Kehl
2023-08-29 14:54:30 -07:00
parent 19dcd7a48b
commit 1ecb747c6d
588 changed files with 34100 additions and 23589 deletions

View File

@@ -4,25 +4,33 @@ 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)
boto_mock = mocker.patch.object(aws_sns_client, "_client", create=True)
to = "6135555555"
content = reference = 'foo'
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'},
'AWS.MM.SMS.OriginationNumber': {'DataType': 'String', 'StringValue': '+18556438890'}
}
"AWS.SNS.SMS.SMSType": {
"DataType": "String",
"StringValue": "Transactional",
},
"AWS.MM.SMS.OriginationNumber": {
"DataType": "String",
"StringValue": "+18556438890",
},
},
)
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)
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)
to = ""
content = reference = 'foo'
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)
assert "No valid numbers found for SMS delivery" in str(excinfo.value)