Add broadcast channel to service schema

This will show which channel is configured, if any, for a service. It
mimics what we are doing for the `allowed_broadcast_provider`.
This commit is contained in:
David McDonald
2021-02-03 16:43:01 +00:00
parent d9cba06017
commit 5d62647b9d
2 changed files with 6 additions and 0 deletions

View File

@@ -236,10 +236,14 @@ class ServiceSchema(BaseSchema, UUIDsAsStringsMixin):
override_flag = False
go_live_at = field_for(models.Service, 'go_live_at', format=DATETIME_FORMAT_NO_TIMEZONE)
allowed_broadcast_provider = fields.Method(dump_only=True, serialize='_get_allowed_broadcast_provider')
broadcast_channel = fields.Method(dump_only=True, serialize='_get_broadcast_channel')
def _get_allowed_broadcast_provider(self, service):
return service.allowed_broadcast_provider
def _get_broadcast_channel(self, service):
return service.broadcast_channel
def get_letter_logo_filename(self, service):
return service.letter_branding and service.letter_branding.filename

View File

@@ -243,6 +243,7 @@ def test_get_service_by_id(admin_request, sample_service):
assert json_resp['data']['email_branding'] is None
assert json_resp['data']['prefix_sms'] is True
assert json_resp['data']['allowed_broadcast_provider'] is None
assert json_resp['data']['broadcast_channel'] is None
assert set(json_resp['data'].keys()) == {
'active',
@@ -250,6 +251,7 @@ def test_get_service_by_id(admin_request, sample_service):
'billing_contact_email_addresses',
'billing_contact_names',
'billing_reference',
'broadcast_channel',
'consent_to_research',
'contact_link',
'count_as_live',