Emergency service instead of emergency services

This commit is contained in:
Pea Tyczynska
2019-07-15 16:28:54 +01:00
parent 8a3ac8400f
commit e4cb56b5d3
5 changed files with 13 additions and 7 deletions

View File

@@ -326,9 +326,9 @@ class Domain(db.Model):
ORGANISATION_TYPES = [ ORGANISATION_TYPES = [
"central", "local", "nhs_central", "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): class OrganisationTypes(db.Model):

View File

@@ -8,7 +8,7 @@ post_create_organisation_schema = {
"properties": { "properties": {
"name": {"type": "string"}, "name": {"type": "string"},
"active": {"type": ["boolean", "null"]}, "active": {"type": ["boolean", "null"]},
"crown": {"type": ["boolean", "null"]}, "crown": {"type": "boolean"},
"organisation_type": {"enum": ORGANISATION_TYPES}, "organisation_type": {"enum": ORGANISATION_TYPES},
}, },
"required": ["name", "crown", "organisation_type"] "required": ["name", "crown", "organisation_type"]

View File

@@ -31,7 +31,7 @@ def upgrade():
["local", False, 25000], ["local", False, 25000],
["nhs_central", False, 250000], ["nhs_central", False, 250000],
["nhs_local", False, 25000], ["nhs_local", False, 25000],
["emergency_services", False, 25000], ["emergency_service", False, 25000],
["school_or_college", False, 25000], ["school_or_college", False, 25000],
["other", None, 25000], ["other", None, 25000],
] ]

View File

@@ -132,7 +132,7 @@ def test_get_organisation_by_domain(
assert response['result'] == 'error' 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): def test_post_create_organisation(admin_request, notify_db_session, crown):
data = { data = {
'name': 'test organisation', 'name': 'test organisation',
@@ -193,12 +193,18 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
'name': 'Service name', 'name': 'Service name',
'crown': True, 'crown': True,
}, 'organisation_type is a required property'), }, '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, 'active': False,
'name': 'Service name', 'name': 'Service name',
'crown': False, 'crown': False,
'organisation_type': 'foo', '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( def test_post_create_organisation_with_missing_data_gives_validation_error(
admin_request, admin_request,

View File

@@ -701,7 +701,7 @@ def test_update_service_flags(client, sample_service):
("local", False), ("local", False),
("nhs_central", False), ("nhs_central", False),
("nhs_local", False), ("nhs_local", False),
("emergency_services", False), ("emergency_service", False),
("school_or_college", False), ("school_or_college", False),
("other", None)]) ("other", None)])
def test_update_service_sets_crown_based_on_org_type(client, sample_service, org_type, expected): def test_update_service_sets_crown_based_on_org_type(client, sample_service, org_type, expected):