mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 17:52:26 -05:00
Add test for sending email while service restricted
This commit is contained in:
@@ -400,6 +400,32 @@ def test_should_send_email_if_restricted_service_and_valid_email(notify_db, noti
|
||||
)
|
||||
|
||||
|
||||
def test_should_not_send_email_if_restricted_service_and_invalid_email_address(notify_db, notify_db_session, mocker):
|
||||
user = sample_user(notify_db, notify_db_session)
|
||||
service = sample_service(notify_db, notify_db_session, user=user, restricted=True)
|
||||
template = sample_template(
|
||||
notify_db, notify_db_session, service=service, template_type='email', subject_line='Hello'
|
||||
)
|
||||
|
||||
notification = {
|
||||
"template": template.id,
|
||||
"to": "test@example.com"
|
||||
}
|
||||
mocker.patch('app.encryption.decrypt', return_value=notification)
|
||||
mocker.patch('app.aws_ses_client.send_email')
|
||||
|
||||
notification_id = uuid.uuid4()
|
||||
now = datetime.utcnow()
|
||||
send_sms(
|
||||
service.id,
|
||||
notification_id,
|
||||
"encrypted-in-reality",
|
||||
now.strftime(DATETIME_FORMAT)
|
||||
)
|
||||
|
||||
aws_ses_client.send_email.assert_not_called()
|
||||
|
||||
|
||||
def test_should_send_template_to_correct_sms_provider_and_persist_with_job_id(sample_job, mocker):
|
||||
notification = {
|
||||
"template": sample_job.template.id,
|
||||
|
||||
Reference in New Issue
Block a user