toulouse-maelis: do not crash reading a family with no birth data (#78027) #304
|
@ -444,7 +444,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
self.add_text_value('Town', data, ['birth', 'communeCode'])
|
||||
self.add_text_value('County', data, ['birth', 'cdDepartment'])
|
||||
self.add_text_value('Country', data, ['birth', 'countryCode'])
|
||||
if data['birth'].get('communeCode'):
|
||||
if data['birth'] and data['birth'].get('communeCode'):
|
||||
city = CityModel.objects.filter(code=data['birth']['communeCode']).first()
|
||||
if city:
|
||||
data['birth']['zipCode'] = city.zipcode
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:readFamilyResponse xmlns:ns2="family.ws.maelis.sigec.com">
|
||||
<familyResult>
|
||||
<number>334363</number>
|
||||
<flagCom>true</flagCom>
|
||||
<nbChild>0</nbChild>
|
||||
<nbTotalChild>0</nbTotalChild>
|
||||
<RL1>
|
||||
<num>198582</num>
|
||||
<firstname>CONTANTIN</firstname>
|
||||
<lastname>GRIGORIU</lastname>
|
||||
<quality>PERE</quality>
|
||||
<civility>MR</civility>
|
||||
<adresse>
|
||||
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
|
||||
<num>0</num>
|
||||
</adresse>
|
||||
<contact>
|
||||
<isContactMail>false</isContactMail>
|
||||
<isContactSms>false</isContactSms>
|
||||
<isInvoicePdf>false</isInvoicePdf>
|
||||
</contact>
|
||||
<profession>
|
||||
<addressPro/>
|
||||
</profession>
|
||||
<indicatorList>
|
||||
<code>NUMPERS_AXEL</code>
|
||||
<libelle>Numéro de personne Axel</libelle>
|
||||
<note>993319</note>
|
||||
</indicatorList>
|
||||
</RL1>
|
||||
</familyResult>
|
||||
</ns2:readFamilyResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -1813,6 +1813,14 @@ def test_read_family_soap_error(family_service, con, app):
|
|||
)
|
||||
|
||||
|
||||
def test_read_family_without_birth(family_service, con, app):
|
||||
family_service.add_soap_response('readFamily', get_xml_file("R_read_family_no_birth.xml"))
|
||||
url = get_endpoint('read-family')
|
||||
|
||||
resp = app.get(url + '?family_id=1312')
|
||||
assert resp.json['data']['RL1']['birth'] is None
|
||||
|
||||
|
||||
def test_read_rl1(family_service, con, app):
|
||||
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
|
||||
url = get_endpoint('read-rl')
|
||||
|
|
Loading…
Reference in New Issue