wip/82705-preSubscribeSchoolPerim-error (#82705) #381

Merged
nroche merged 2 commits from wip/82705-preSubscribeSchoolPerim-error into main 2023-11-10 09:51:21 +01:00
4 changed files with 65 additions and 0 deletions

View File

@ -2663,6 +2663,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
def create_child_school_pre_registration(self, request, post_data):
response = self.call('Family', 'preSubscribeSchoolPerim', **post_data)
if not response.get('subscribeSchoolBean'):
raise APIError(response.get('returnMessage') or 'no data returned')
return {'data': response}
@endpoint(

View File

@ -0,0 +1,9 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:preSubscribeSchoolPerimResponse xmlns:ns2="family.ws.maelis.sigec.com">
<resultSubscribeBean>
<returnMessage>E113 : Il existe déjà une inscription scolaire pour cet enfant</returnMessage>
</resultSubscribeBean>
</ns2:preSubscribeSchoolPerimResponse>
</soap:Body>
</soap:Envelope>

View File

@ -0,0 +1,13 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>E25 : Cette personne nappartient pas à cette famille</faultstring>
<detail>
<ns1:MaelisFamilyException xmlns:ns1="family.ws.maelis.sigec.com">
<message xmlns:ns2="family.ws.maelis.sigec.com">E25 : Cette personne nappartient pas à cette famille</message>
</ns1:MaelisFamilyException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

View File

@ -6216,6 +6216,47 @@ def test_create_child_school_pre_registration(family_service, con, app):
assert resp.json['data']['subscribeSchoolBean']['isWaitList']
def test_create_child_school_pre_registration_soap_error(family_service, con, app):
family_service.add_soap_response(
'preSubscribeSchoolPerim', get_xml_file('R_create_child_school_pre_registration_soap_error.xml')
)
url = get_endpoint('create-child-school-pre-registration')
resp = app.post_json(
url,
params={
'numPerson': '248460',
'schoolYear': '2023',
'levelCode': 'CM1',
'dateSubscribe': '2023-09-01T00:00:00+02:00',
},
)
assert resp.json['err'] == 1
assert resp.json['err_class'] == 'passerelle.utils.soap.SOAPFault'
assert (
resp.json['err_desc']
== 'SOAP service at https://example.org/FamilyService?wsdl returned an error "E25 : Cette personne nappartient pas à cette famille"'
)
def test_create_child_school_pre_registration_maelis_error(family_service, con, app):
family_service.add_soap_response(
'preSubscribeSchoolPerim', get_xml_file('R_create_child_school_pre_registration_maelis_error.xml')
)
url = get_endpoint('create-child-school-pre-registration')
resp = app.post_json(
url,
params={
'numPerson': '248460',
'schoolYear': '2023',
'levelCode': 'CM1',
'dateSubscribe': '2023-09-01T00:00:00+02:00',
},
)
assert resp.json['err'] == 1
assert resp.json['err_class'] == 'passerelle.utils.jsonresponse.APIError'
assert resp.json['err_desc'] == 'E113 : Il existe déjà une inscription scolaire pour cet enfant'
def test_create_child_school_pre_registration_with_exemption(family_service, con, app):
family_service.add_soap_response(
'presubscribeSchoolDerog', get_xml_file('R_create_child_school_pre_registration_with_exemption.xml')