Store organisation type against each service

> So that we can default services to their appropriate text allowance,
> we need to find out what sector they're in. So let's start collecting
> that from teams as they create new services.

In order to work out what a team’s allowance should be, we need to know
what part of government they’re from. We’re going to do this logic in
the admin app and then `POST` the allowance to the API.

So all we need to do with the information that the users give us is
store it against the service, so we have a record. Doesn’t need any
logic doing as a result of it, doesn’t need foreign keying to the
organisations table, etc.
This commit is contained in:
Chris Hill-Scott
2017-10-05 15:14:27 +01:00
parent baab9dd86f
commit 2a5e6c2d0c
4 changed files with 44 additions and 1 deletions

View File

@@ -177,6 +177,19 @@ def test_get_detailed_service_by_id_returns_free_sms_limit(client, sample_servic
assert json_resp['data']['free_sms_fragment_limit'] == current_app.config['FREE_SMS_TIER_FRAGMENT_COUNT']
@pytest.mark.parametrize('endpoint', ['/service/{}', '/service/{}?detailed=True'])
def test_get_service_by_id_returns_organisation_type(client, sample_service, endpoint):
auth_header = create_authorization_header()
resp = client.get(
endpoint.format(sample_service.id),
headers=[auth_header]
)
assert resp.status_code == 200
json_resp = json.loads(resp.get_data(as_text=True))
assert json_resp['data']['organisation_type'] is None
def test_get_service_list_has_default_permissions(client, service_factory):
service_factory.get('one')
service_factory.get('one')
@@ -499,7 +512,8 @@ def test_update_service(client, notify_db, sample_service):
'email_from': 'updated.service.name',
'created_by': str(sample_service.created_by.id),
'organisation': str(org.id),
'dvla_organisation': DVLA_ORG_LAND_REGISTRY
'dvla_organisation': DVLA_ORG_LAND_REGISTRY,
'organisation_type': 'foo',
}
auth_header = create_authorization_header()
@@ -515,6 +529,7 @@ def test_update_service(client, notify_db, sample_service):
assert result['data']['email_from'] == 'updated.service.name'
assert result['data']['organisation'] == str(org.id)
assert result['data']['dvla_organisation'] == DVLA_ORG_LAND_REGISTRY
assert result['data']['organisation_type'] == 'foo'
def test_update_service_flags(client, sample_service):