mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Make SMS prefix setting non-nullable
We have now: - defaulted new services to start with this column set to `true` - migrated all preexisting services[1] to have either `true` or `false` set for this column There is no way for a service to switch back from `true`/`false` to `null`. This means that we can safely enforce a non-nullable constraint on this column now. 1. There is a little gotcha: the GOV.UK Notify service still relies on the `sms_sender` column. It doesn’t have a row in the `service_sms_senders` table. This means the previous migration never changed this service’s value for `prefix_sms` from `null`. So this commit also changes its value to `False`, so that the rest of the migration, of the whole column, is possible.
This commit is contained in:
@@ -1551,7 +1551,6 @@ def test_prefixing_messages_based_on_prefix_sms(
|
||||
@pytest.mark.parametrize('posted_value, stored_value, returned_value', [
|
||||
(True, True, True),
|
||||
(False, False, False),
|
||||
(None, None, True),
|
||||
])
|
||||
def test_set_sms_prefixing_for_service(
|
||||
client,
|
||||
@@ -1581,6 +1580,18 @@ def test_set_sms_prefixing_for_service(
|
||||
assert result['data']['sms_sender'] == current_app.config['FROM_NUMBER']
|
||||
|
||||
|
||||
def test_set_sms_prefixing_for_service_cant_be_none(
|
||||
admin_request,
|
||||
sample_service,
|
||||
):
|
||||
admin_request.post(
|
||||
'service.update_service',
|
||||
service_id=sample_service.id,
|
||||
_data={'prefix_sms': None},
|
||||
_expected_status=500,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('today_only,stats', [
|
||||
('False', {'requested': 2, 'delivered': 1, 'failed': 0}),
|
||||
('True', {'requested': 1, 'delivered': 0, 'failed': 0})
|
||||
|
||||
Reference in New Issue
Block a user