From e4cb56b5d3436d80dc530dc807ccf4640545df77 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Mon, 15 Jul 2019 16:28:54 +0100 Subject: [PATCH] Emergency service instead of emergency services --- app/models.py | 4 ++-- app/organisation/organisation_schema.py | 2 +- migrations/versions/0299_org_types_table.py | 2 +- tests/app/organisation/test_rest.py | 10 ++++++++-- tests/app/service/test_rest.py | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/models.py b/app/models.py index a0ff1fb71..90411419c 100644 --- a/app/models.py +++ b/app/models.py @@ -326,9 +326,9 @@ class Domain(db.Model): ORGANISATION_TYPES = [ "central", "local", "nhs_central", - "nhs_local", "emergency_services", "school_or_college", "other", + "nhs_local", "emergency_service", "school_or_college", "other", ] -NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_central", "nhs_local", "emergency_services", "school_or_college"] +NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_central", "nhs_local", "emergency_service", "school_or_college"] class OrganisationTypes(db.Model): diff --git a/app/organisation/organisation_schema.py b/app/organisation/organisation_schema.py index 0a165caa6..44018385e 100644 --- a/app/organisation/organisation_schema.py +++ b/app/organisation/organisation_schema.py @@ -8,7 +8,7 @@ post_create_organisation_schema = { "properties": { "name": {"type": "string"}, "active": {"type": ["boolean", "null"]}, - "crown": {"type": ["boolean", "null"]}, + "crown": {"type": "boolean"}, "organisation_type": {"enum": ORGANISATION_TYPES}, }, "required": ["name", "crown", "organisation_type"] diff --git a/migrations/versions/0299_org_types_table.py b/migrations/versions/0299_org_types_table.py index c9c3dca92..6b273519d 100644 --- a/migrations/versions/0299_org_types_table.py +++ b/migrations/versions/0299_org_types_table.py @@ -31,7 +31,7 @@ def upgrade(): ["local", False, 25000], ["nhs_central", False, 250000], ["nhs_local", False, 25000], - ["emergency_services", False, 25000], + ["emergency_service", False, 25000], ["school_or_college", False, 25000], ["other", None, 25000], ] diff --git a/tests/app/organisation/test_rest.py b/tests/app/organisation/test_rest.py index 3250c57e0..b6d0f0341 100644 --- a/tests/app/organisation/test_rest.py +++ b/tests/app/organisation/test_rest.py @@ -132,7 +132,7 @@ def test_get_organisation_by_domain( assert response['result'] == 'error' -@pytest.mark.parametrize('crown', [True, False, None]) +@pytest.mark.parametrize('crown', [True, False]) def test_post_create_organisation(admin_request, notify_db_session, crown): data = { 'name': 'test organisation', @@ -193,12 +193,18 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample 'name': 'Service name', 'crown': True, }, 'organisation_type is a required property'), + ({ + 'active': False, + 'name': 'Service name', + 'crown': None, + 'organisation_type': 'central', + }, 'crown None is not of type boolean'), ({ 'active': False, 'name': 'Service name', 'crown': False, 'organisation_type': 'foo', - }, 'organisation_type foo is not one of [central, local, nhs_central, nhs_local, emergency_services, school_or_college, other]'), # noqa + }, 'organisation_type foo is not one of [central, local, nhs_central, nhs_local, emergency_service, school_or_college, other]'), # noqa )) def test_post_create_organisation_with_missing_data_gives_validation_error( admin_request, diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index f5a40ea68..0d02a5140 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -701,7 +701,7 @@ def test_update_service_flags(client, sample_service): ("local", False), ("nhs_central", False), ("nhs_local", False), - ("emergency_services", False), + ("emergency_service", False), ("school_or_college", False), ("other", None)]) def test_update_service_sets_crown_based_on_org_type(client, sample_service, org_type, expected):