Move provider restriction into broadcast settings

This means we will have a much easier way of knowing what the settings
are for a broadcast service.

Note, we can just move data directly into the newer table as there is
nothing on the API or admin app that is putting data in the
`service_broadcast_provider_restriction` table, this was being done
manually for the few services that needed it.
This commit is contained in:
David McDonald
2021-02-09 09:38:43 +00:00
parent e0ddb5a39e
commit b2213dad19
4 changed files with 50 additions and 19 deletions

View File

@@ -19,7 +19,7 @@ from app.models import (
Notification,
Permission,
Service,
ServiceBroadcastProviderRestriction,
ServiceBroadcastSettings,
ServiceEmailReplyTo,
ServiceLetterContact,
ServicePermission,
@@ -280,11 +280,8 @@ def test_get_service_by_id(admin_request, sample_service):
def test_get_service_by_id_returns_allowed_broadcast_provider(notify_db, admin_request, sample_service):
notify_db.session.add(ServiceBroadcastProviderRestriction(
service=sample_service,
provider='ee'
))
notify_db.session.commit()
settings = ServiceBroadcastSettings(service=sample_service, channel="severe", provider="ee")
notify_db.session.add(settings)
json_resp = admin_request.get('service.get_service_by_id', service_id=sample_service.id)
assert json_resp['data']['id'] == str(sample_service.id)