Set crown if organisation_type is updated on service.

Add some tests.
Update the initial values of crown.
This commit is contained in:
Rebecca Law
2017-12-04 16:07:26 +00:00
parent f73319f5ef
commit 7fa4e7ffc7
4 changed files with 35 additions and 0 deletions

View File

@@ -178,7 +178,11 @@ def update_service(service_id):
service_going_live = fetched_service.restricted and not req_json.get('restricted', True)
current_data = dict(service_schema.dump(fetched_service).data.items())
current_data.update(request.get_json())
update_dict = service_schema.load(current_data).data
org_type = req_json.get('organisation_type', None)
if org_type:
update_dict.crown = org_type == 'central'
dao_update_service(update_dict)
# bridging code between frontend is deployed and data has not been migrated yet. Can only update current year