Only return active SMS senders

Updated the DAO methods which return a single SMS sender and all SMS senders
to only return the non-archived senders. Changed the error raised in the Admin
interface from a SQLAlchemyError to a BadRequestError.
This commit is contained in:
Katie Smith
2018-04-25 14:23:00 +01:00
parent f810daa3c5
commit 663021e494
7 changed files with 77 additions and 19 deletions

View File

@@ -3,7 +3,6 @@ from unittest.mock import Mock
import pytest
from notifications_utils.recipients import InvalidPhoneError
from sqlalchemy.exc import SQLAlchemyError
from app.v2.errors import BadRequestError, TooManyRequestsError
from app.config import QueueNames
@@ -334,5 +333,6 @@ def test_send_one_off_notification_should_throw_exception_if_sms_sender_id_doesn
'created_by': str(sample_template.service.created_by_id)
}
with pytest.raises(expected_exception=SQLAlchemyError):
with pytest.raises(expected_exception=BadRequestError) as e:
send_one_off_notification(service_id=sample_template.service.id, post_data=data)
assert e.value.message == 'SMS sender not found'