toulouse-maelis: ajouter le département aux informations de naissances #209

Merged
nroche merged 8 commits from wip/76608-parsifal-birth-county into main 2023-04-17 17:28:51 +02:00
3 changed files with 52 additions and 0 deletions
Showing only changes of commit c9edd27570 - Show all commits

View File

@ -170,6 +170,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'ChildIndicator',
'Civility',
'Country',
'County',
'CSP',
'DietCode',
'Document',
@ -818,6 +819,21 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def read_country_list(self, request, id=None, q=None, limit=None, distinct=True):
return {'data': self.get_referential('Country', id, q, limit, distinct)}
@endpoint(
display_category='Famille',
description='Lister les départements',
name='read-county-list',
perm='can_access',
parameters={
'id': {'description': 'Identifiant de lenregistrement'},
'q': {'description': 'Recherche en texte intégral'},
'limit': {'description': 'Nombre maximal de résultats; doit être inférieur à 20.'},
'distinct': {'description': 'Ne pas inclure les valeurs dupliquées'},
},
)
def read_county_list(self, request, id=None, q=None, limit=None, distinct=True):
return {'data': self.get_referential('County', id, q, limit, distinct)}
@endpoint(
display_category='Famille',
description='Lister les communes',

View File

@ -0,0 +1,22 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:readCountyListResponse xmlns:ns2="family.ws.maelis.sigec.com">
<itemList>
<code>01</code>
<libelle>AIN</libelle>
</itemList>
<itemList>
<code>02</code>
<libelle>AISNE</libelle>
</itemList>
<itemList>
<code>03</code>
<libelle>ALLIER</libelle>
</itemList>
<itemList>
<code>91</code>
<libelle>ESSONNE</libelle>
</itemList>
</ns2:readCountyListResponse>
</soap:Body>
</soap:Envelope>

View File

@ -189,6 +189,7 @@ def django_db_setup(django_db_setup, django_db_blocker):
)
soap_mock.add_soap_response('readCivilityList', get_xml_file('R_read_civility_list.xml'))
soap_mock.add_soap_response('readCountryList', get_xml_file('R_read_country_list.xml'))
soap_mock.add_soap_response('readCountyList', get_xml_file('R_read_county_list.xml'))
soap_mock.add_soap_response('readCSPList', get_xml_file('R_read_csp_list.xml'))
soap_mock.add_soap_response('readDietCodeList', get_xml_file('R_read_dietcode_list.xml'))
soap_mock.add_soap_response('readDocumentList', get_xml_file('R_read_document_list.xml'))
@ -506,6 +507,7 @@ def test_cron(db):
'Civility',
'Complement',
'Country',
'County',
'DerogReason',
'DietCode',
'Direct',
@ -664,6 +666,18 @@ def test_read_country_list(con, app):
]
def test_read_county_list(con, app):
url = get_endpoint('read-county-list')
resp = app.get(url)
assert resp.json['err'] == 0
assert len(resp.json['data']) == 4
assert resp.json['data'][:3] == [
{'id': '01', 'code': '01', 'text': 'AIN', 'libelle': 'AIN'},
{'id': '02', 'code': '02', 'text': 'AISNE', 'libelle': 'AISNE'},
{'id': '03', 'code': '03', 'text': 'ALLIER', 'libelle': 'ALLIER'},
]
def test_read_town_list(con, app):
url = get_endpoint('read-town-list')
resp = app.get(url)