diff --git a/passerelle/contrib/caluire_axel/models.py b/passerelle/contrib/caluire_axel/models.py index 8ecb9345..f37e19c3 100644 --- a/passerelle/contrib/caluire_axel/models.py +++ b/passerelle/contrib/caluire_axel/models.py @@ -167,6 +167,12 @@ class CaluireAxel(BaseResource): family_data = result.json_response['DATA']['PORTAIL']['GETFAMILLE'] + family_data['CODE'] = family_data['CODE'][0] + if family_data.get('RESPONSABLE1'): + family_data['RESPONSABLE1'] = family_data['RESPONSABLE1'][0] + if family_data.get('RESPONSABLE2'): + family_data['RESPONSABLE2'] = family_data['RESPONSABLE2'][0] + for child in family_data.get('MEMBRE', []): child['id'] = child['IDENT'] child['text'] = '{} {}'.format(child['PRENOM'].strip(), child['NOM'].strip()).strip() diff --git a/passerelle/contrib/caluire_axel/xsd/R_GetFamilleIndividus.xsd b/passerelle/contrib/caluire_axel/xsd/R_GetFamilleIndividus.xsd index b4038d58..84145c14 100644 --- a/passerelle/contrib/caluire_axel/xsd/R_GetFamilleIndividus.xsd +++ b/passerelle/contrib/caluire_axel/xsd/R_GetFamilleIndividus.xsd @@ -22,7 +22,7 @@ - + diff --git a/tests/test_caluire_axel.py b/tests/test_caluire_axel.py index fe9dc061..19bd363c 100644 --- a/tests/test_caluire_axel.py +++ b/tests/test_caluire_axel.py @@ -485,6 +485,7 @@ def test_family_info_endpoint(app, resource): assert set(resp.json['data'].keys()) == set( ['family_id', 'CODE', 'MEMBRE', 'RESPONSABLE1', 'RESPONSABLE2'] ) + assert resp.json['data']['CODE'] == 0 assert resp.json['data']['family_id'] == 'XXX' assert resp.json['data']['MEMBRE'][0]['id'] == '50632' assert resp.json['data']['MEMBRE'][0]['text'] == 'Enfant 1 CALUIRE TEST' @@ -494,6 +495,7 @@ def test_family_info_endpoint(app, resource): assert resp.json['data']['MEMBRE'][2]['text'] == 'Enfant 3 CALUIRE TEST' assert resp.json['data']['MEMBRE'][3]['id'] == '59509' assert resp.json['data']['MEMBRE'][3]['text'] == 'Enfant 5 CALUIRE TEST' + assert resp.json['data']['RESPONSABLE1']['IDENT'] == '50630' # again - data are in cache resp = app.get('/caluire-axel/test/family_info?NameID=yyy')