toulouse-maelis: manage applicative error on school registration (#82705)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d0f4b9ecf9
commit
1b0c842d48
|
@ -2699,6 +2699,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(
|
||||
|
|
|
@ -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>
|
|
@ -6242,6 +6242,25 @@ def test_create_child_school_pre_registration_soap_error(family_service, con, ap
|
|||
)
|
||||
|
||||
|
||||
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')
|
||||
|
|
Loading…
Reference in New Issue