api_particulier: normalize birth dates (#77306)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
54dbbc3148
commit
2277fcdd23
|
@ -363,6 +363,11 @@ class APIParticulier(BaseResource):
|
||||||
)
|
)
|
||||||
data['data']['numero_allocataire'] = numero_allocataire
|
data['data']['numero_allocataire'] = numero_allocataire
|
||||||
data['data']['code_postal'] = code_postal
|
data['data']['code_postal'] = code_postal
|
||||||
|
for kind in 'allocataires', 'enfants':
|
||||||
|
for person in data['data'].get(kind) or []:
|
||||||
|
if len(person.get('dateDeNaissance') or '') == 8:
|
||||||
|
birthdate = person['dateDeNaissance']
|
||||||
|
person['dateDeNaissance_iso'] = birthdate[4:] + '-' + birthdate[2:4] + '-' + birthdate[:2]
|
||||||
return data
|
return data
|
||||||
|
|
||||||
category = _('Business Process Connectors')
|
category = _('Business Process Connectors')
|
||||||
|
|
|
@ -319,6 +319,10 @@ def test_situation_familiale(app, resource, mock_api_particulier):
|
||||||
'/api-particulier/test/situation-familiale', app, resource, 'situation-familiale', params=params
|
'/api-particulier/test/situation-familiale', app, resource, 'situation-familiale', params=params
|
||||||
)
|
)
|
||||||
assert resp.json['data']['adresse']['codePostalVille'] == '12345 CONDAT'
|
assert resp.json['data']['adresse']['codePostalVille'] == '12345 CONDAT'
|
||||||
|
assert resp.json['data']['enfants'][0]['dateDeNaissance'] == '11122016'
|
||||||
|
assert resp.json['data']['enfants'][0]['dateDeNaissance_iso'] == '2016-12-11'
|
||||||
|
assert resp.json['data']['allocataires'][1]['dateDeNaissance'] == '18101969'
|
||||||
|
assert resp.json['data']['allocataires'][1]['dateDeNaissance_iso'] == '1969-10-18'
|
||||||
|
|
||||||
params['numero_allocataire'] = '11'
|
params['numero_allocataire'] = '11'
|
||||||
resp = endpoint_get(
|
resp = endpoint_get(
|
||||||
|
|
Loading…
Reference in New Issue