toulouse_maelis: adapt updateFamily error format (#67791)
This commit is contained in:
parent
79d3cdbe60
commit
9f916e1827
|
@ -455,8 +455,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
response = self.call('Family', 'updateFamily', dossierNumber=family_id, **post_data)
|
||||
data = serialize_object(response)
|
||||
family_id = data.get('number')
|
||||
if not family_id:
|
||||
errors = data.get('rl1ErrorList') + data.get('childErrorList')
|
||||
errors = data.get('childErrorList')
|
||||
if errors:
|
||||
err_codes = [x.split(':')[0][:4] for x in errors]
|
||||
raise APIError(' ; '.join(errors), err_code=', '.join(err_codes))
|
||||
return {'data': data}
|
||||
|
|
|
@ -1,14 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf8"?>
|
||||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:updateFamilyResponse xmlns:ns2="family.ws.maelis.sigec.com">
|
||||
<familyResult>
|
||||
<number>0</number>
|
||||
<number>196569</number>
|
||||
<category>BI</category>
|
||||
<situation>C</situation>
|
||||
<flagCom>true</flagCom>
|
||||
<RL1>
|
||||
<num>614061</num>
|
||||
<lastname>DOEE</lastname>
|
||||
<firstname>JHON</firstname>
|
||||
<quality>AU</quality>
|
||||
<civility>MR</civility>
|
||||
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
|
||||
<adresse>
|
||||
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
|
||||
<num>0</num>
|
||||
<street1>Chateau</street1>
|
||||
<town>Paris</town>
|
||||
<zipcode>75014</zipcode>
|
||||
</adresse>
|
||||
<contact>
|
||||
<isContactMail>false</isContactMail>
|
||||
<isContactSms>false</isContactSms>
|
||||
<isInvoicePdf>false</isInvoicePdf>
|
||||
</contact>
|
||||
</RL1>
|
||||
<RL2>
|
||||
<num>614062</num>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>JANNETTE</firstname>
|
||||
<quality>MERE</quality>
|
||||
<civility>MR</civility>
|
||||
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
|
||||
<adresse>
|
||||
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
|
||||
<num>0</num>
|
||||
<street1>Chateau</street1>
|
||||
<town>Paris</town>
|
||||
<zipcode>75014</zipcode>
|
||||
</adresse>
|
||||
<contact>
|
||||
<isContactMail>false</isContactMail>
|
||||
<isContactSms>false</isContactSms>
|
||||
<isInvoicePdf>false</isInvoicePdf>
|
||||
</contact>
|
||||
</RL2>
|
||||
<childErrorList>E65a : Il existe déjà un enfant correspondant au nom [ZIMMERMAN], prénom [ROBERT], date de naissance [24/05/1941] - Personne n°[614051] - Famille n°[196544]</childErrorList>
|
||||
</familyResult>
|
||||
</ns2:updateFamilyResponse>
|
||||
|
|
|
@ -961,14 +961,9 @@ def test_update_family_maelis_error(mocked_post, mocked_get, con, app):
|
|||
}
|
||||
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
# get 500 because error repsonse is wrongly formatted
|
||||
resp = app.post_json(url + '?NameID=local', params=params, status=500)
|
||||
assert resp.json == {
|
||||
'err': 1,
|
||||
'err_class': 'zeep.exceptions.XMLParseError',
|
||||
'err_desc': "Unexpected element 'adresse', expected 'lastname'",
|
||||
'data': None,
|
||||
}
|
||||
resp = app.post_json(url + '?NameID=local', params=params)
|
||||
assert resp.json['err'] == 'E65a'
|
||||
assert "E65a : Il existe déjà un enfant" in resp.json['err_desc']
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
|
|
Loading…
Reference in New Issue