mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 01:56:03 -04:00
Use sample_broadcast_service fixture
Now that every service has a row in the service_broadcast_settings table, we want all our tests to use the `sample_broadcast_service` fixture as this ensures it has a row in that table and is correctly representitive of what a real broadcast service looks like.
This commit is contained in:
@@ -282,23 +282,22 @@ 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):
|
||||
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)
|
||||
assert json_resp['data']['allowed_broadcast_provider'] == 'ee'
|
||||
|
||||
|
||||
def test_get_service_by_id_for_broadcast_service_takes_channel_from_service_broadcast_settings(
|
||||
admin_request, sample_broadcast_service
|
||||
@pytest.mark.parametrize('broadcast_channel,allowed_broadcast_provider', (
|
||||
('test', None),
|
||||
('severe', None),
|
||||
('test', 'ee'),
|
||||
('severe', 'three'),
|
||||
))
|
||||
def test_get_service_by_id_for_broadcast_service_returns_broadcast_keys(
|
||||
notify_db, admin_request, sample_broadcast_service, broadcast_channel, allowed_broadcast_provider
|
||||
):
|
||||
assert sample_broadcast_service.broadcast_channel == 'severe'
|
||||
sample_broadcast_service.broadcast_channel = broadcast_channel
|
||||
sample_broadcast_service.allowed_broadcast_provider = allowed_broadcast_provider
|
||||
|
||||
json_resp = admin_request.get('service.get_service_by_id', service_id=sample_broadcast_service.id)
|
||||
assert json_resp['data']['id'] == str(sample_broadcast_service.id)
|
||||
assert json_resp['data']['broadcast_channel'] == 'severe'
|
||||
assert json_resp['data']['allowed_broadcast_provider'] == allowed_broadcast_provider
|
||||
assert json_resp['data']['broadcast_channel'] == broadcast_channel
|
||||
|
||||
|
||||
def test_get_service_by_id_for_service_with_broadcast_permission_sets_channel_as_test_if_no_service_broadcast_settings(
|
||||
|
||||
Reference in New Issue
Block a user