From 16ee040923adf4c501df5012d5223fd87a544001 Mon Sep 17 00:00:00 2001 From: David McDonald Date: Thu, 4 Feb 2021 15:08:50 +0000 Subject: [PATCH] Add service broadcast settings to `sample_broadcast_service` This will make our `sample_broadcast_service` look more realistic. The one downside to this, is that there will be a short amount of time where we have broadcast services that do not have a row in the service_broadcast_settings table until we have backfilled this data. Our unit tests therefore won't have coverage for this case but I think the risk is small and acceptable for the moment as this will no longer be the case in say a weeks time. --- tests/app/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/app/conftest.py b/tests/app/conftest.py index dd02564a1..9ea4e70cd 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -16,6 +16,7 @@ from app.dao.jobs_dao import dao_create_job from app.dao.notifications_dao import dao_create_notification from app.dao.organisation_dao import dao_create_organisation from app.dao.services_dao import (dao_create_service, dao_add_user_to_service) +from app.dao.service_broadcast_settings_dao import insert_or_update_service_broadcast_settings from app.dao.templates_dao import dao_create_template from app.dao.users_dao import create_secret_code, create_user_code from app.history_meta import create_history @@ -42,7 +43,7 @@ from app.models import ( LETTER_TYPE, SERVICE_PERMISSION_TYPES, ServiceEmailReplyTo, - BROADCAST_TYPE + BROADCAST_TYPE, ) from tests import create_authorization_header from tests.app.db import ( @@ -167,6 +168,7 @@ def sample_broadcast_service(notify_db_session): if not service: service = Service(**data) dao_create_service(service, user, service_permissions=[BROADCAST_TYPE]) + insert_or_update_service_broadcast_settings(service, channel="severe") else: if user not in service.users: dao_add_user_to_service(service, user)