From 8d9038c3e926d84ad71b80e05b1018019394884c Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 28 Aug 2019 15:33:00 +0100 Subject: [PATCH] Give GP practices NHS branding by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we were doing it based on their email address. This will also apply it if they self-select as a GP surgery, even if they don’t have an NHS email address. --- app/dao/services_dao.py | 3 ++- app/models.py | 1 + tests/app/dao/test_services_dao.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/dao/services_dao.py b/app/dao/services_dao.py index 988908616..666034ad1 100644 --- a/app/dao/services_dao.py +++ b/app/dao/services_dao.py @@ -42,6 +42,7 @@ from app.models import ( EMAIL_TYPE, INTERNATIONAL_SMS_TYPE, KEY_TYPE_TEST, + NHS_ORGANISATION_TYPES, NON_CROWN_ORGANISATION_TYPES, SMS_TYPE, LETTER_TYPE, @@ -306,7 +307,7 @@ def dao_create_service( if organisation.letter_branding and not service.letter_branding: service.letter_branding = organisation.letter_branding - elif service.organisation_type in ['nhs_central', 'nhs_local'] or email_address_is_nhs(user.email_address): + elif service.organisation_type in NHS_ORGANISATION_TYPES or email_address_is_nhs(user.email_address): service.email_branding = dao_get_email_branding_by_name('NHS') service.letter_branding = dao_get_letter_branding_by_name('NHS') if organisation: diff --git a/app/models.py b/app/models.py index 20c4ba5af..60d683980 100644 --- a/app/models.py +++ b/app/models.py @@ -331,6 +331,7 @@ ORGANISATION_TYPES = [ CROWN_ORGANISATION_TYPES = ["nhs_central"] NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_local", "nhs_gp", "emergency_service", "school_or_college"] +NHS_ORGANISATION_TYPES = ["nhs_central", "nhs_local", "nhs_gp"] class OrganisationTypes(db.Model): diff --git a/tests/app/dao/test_services_dao.py b/tests/app/dao/test_services_dao.py index 1a64c85af..74505f18d 100644 --- a/tests/app/dao/test_services_dao.py +++ b/tests/app/dao/test_services_dao.py @@ -143,6 +143,8 @@ def test_create_service_with_organisation(notify_db_session): @pytest.mark.parametrize('email_address, organisation_type', ( ("test@example.gov.uk", 'nhs_central'), + ("test@example.gov.uk", 'nhs_local'), + ("test@example.gov.uk", 'nhs_gp'), ("test@nhs.net", 'nhs_local'), ("test@nhs.net", 'local'), ("test@nhs.net", 'central'),