toulouse-maelis: manage emergency person list on createFamily (#71646)
This commit is contained in:
parent
25de4254aa
commit
8428ad7386
|
@ -628,6 +628,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
self.assert_family_payload_in_referential(post_data)
|
||||
self.replace_null_values(post_data)
|
||||
|
||||
# adapt payload to use same input as create_family
|
||||
if len(post_data.get('emergencyPersonList', [])):
|
||||
persons = post_data.pop('emergencyPersonList')
|
||||
post_data['emergencyPersonList'] = [{'personList': persons}]
|
||||
|
||||
response = self.call('Family', 'updateFamily', dossierNumber=family_id, **post_data)
|
||||
data = serialize_object(response)
|
||||
family_id = data.get('number')
|
||||
|
|
|
@ -122,25 +122,6 @@ EMERGENCY_PERSON_SCHEMA = {
|
|||
EMERGENCY_PERSON_SCHEMA['properties'].update(PERSON_PROPERTIES)
|
||||
|
||||
|
||||
EMERGENCY_PERSON_LIST_SCHEMA = {
|
||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||
'title': 'Family persons',
|
||||
'description': "Liste des personnes à prévenir en cas d'urgence",
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'personList': {
|
||||
'oneOf': [
|
||||
{
|
||||
'type': 'array',
|
||||
'items': EMERGENCY_PERSON_SCHEMA,
|
||||
},
|
||||
{'type': 'null'},
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
AUTHORIZED_PERSON_SCHEMA = {
|
||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||
'title': 'Family persons',
|
||||
|
@ -605,7 +586,7 @@ UPDATE_FAMILY_SCHEMA = {
|
|||
'oneOf': [
|
||||
{
|
||||
'type': 'array',
|
||||
'items': EMERGENCY_PERSON_LIST_SCHEMA,
|
||||
'items': EMERGENCY_PERSON_SCHEMA,
|
||||
},
|
||||
{'type': 'null'},
|
||||
],
|
||||
|
|
|
@ -1252,12 +1252,12 @@ def test_update_family(mocked_post, mocked_get, con, app):
|
|||
'rl1/adresse/numComp': 'B',
|
||||
'rl1/profession/codeCSP': 'ART',
|
||||
'rl1/CAFInfo/organ': 'A10007752822',
|
||||
'emergencyPersonList/0/personList/0/civility': 'MME',
|
||||
'emergencyPersonList/0/personList/0/firstname': 'Keny',
|
||||
'emergencyPersonList/0/personList/0/lastname': 'Arkana',
|
||||
'emergencyPersonList/0/personList/0/sexe': 'F',
|
||||
'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
|
||||
'emergencyPersonList/0/personList/0/quality': 'T',
|
||||
'emergencyPersonList/0/civility': 'MME',
|
||||
'emergencyPersonList/0/firstname': 'Keny',
|
||||
'emergencyPersonList/0/lastname': 'Arkana',
|
||||
'emergencyPersonList/0/sexe': 'F',
|
||||
'emergencyPersonList/0/dateBirth': '1982-12-20',
|
||||
'emergencyPersonList/0/quality': 'T',
|
||||
'childList/0/lastname': 'Zimmerman', # add child
|
||||
'childList/0/firstname': 'Robert',
|
||||
'childList/0/sexe': 'M',
|
||||
|
@ -1387,12 +1387,12 @@ def test_update_family_wrong_referential_key_error(mocked_post, mocked_get, con,
|
|||
'rl1/adresse/numComp': 'B',
|
||||
'rl1/profession/codeCSP': 'ART',
|
||||
'rl1/CAFInfo/organ': 'A10007752822',
|
||||
'emergencyPersonList/0/personList/0/civility': 'MME',
|
||||
'emergencyPersonList/0/personList/0/firstname': 'Keny',
|
||||
'emergencyPersonList/0/personList/0/lastname': 'Arkana',
|
||||
'emergencyPersonList/0/personList/0/sexe': 'F',
|
||||
'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
|
||||
'emergencyPersonList/0/personList/0/quality': 'T',
|
||||
'emergencyPersonList/0/civility': 'MME',
|
||||
'emergencyPersonList/0/firstname': 'Keny',
|
||||
'emergencyPersonList/0/lastname': 'Arkana',
|
||||
'emergencyPersonList/0/sexe': 'F',
|
||||
'emergencyPersonList/0/dateBirth': '1982-12-20',
|
||||
'emergencyPersonList/0/quality': 'T',
|
||||
'childList/0/lastname': 'Zimmerman',
|
||||
'childList/0/firstname': 'Robert',
|
||||
'childList/0/sexe': 'M',
|
||||
|
|
Loading…
Reference in New Issue