toulouse-maelis: get id and text for school derog list (#74194)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details
gitea/passerelle/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Nicolas Roche 2023-02-05 15:17:55 +01:00 committed by Gitea
parent 1966e170de
commit b5f9ca5244
3 changed files with 77 additions and 2 deletions

View File

@ -2100,7 +2100,15 @@ class ToulouseMaelis(BaseResource, HTTPResource):
response = self.call(
'Family', 'getChildSubscribeSchoolInformation', getFamilySubscribeSchoolInfoRequestBean=data
)
return {'data': serialize_object(response)}
data = serialize_object(response)
if data['childSubscribeSchoolInformation'].get('subscribeSchoolInformation'):
schools = data['childSubscribeSchoolInformation']['subscribeSchoolInformation'].get(
'derogSchoolList'
)
for item in schools or []:
item['id'] = item['idSchool']
item['text'] = item['schoolName']
return {'data': data}
@endpoint(
display_category='Inscriptions',

View File

@ -35,6 +35,65 @@
<zipcode>31400</zipcode>
</address>
</person>
<subscribeSchoolInformation>
<schoolYear>2022</schoolYear>
<level>
<code>CP</code>
</level>
<perim>
<idPerim>2446</idPerim>
<libelle>FRANCE ANATOLE</libelle>
<perimSchoolList>
<idSchool>2589</idSchool>
<schoolName>FRANCE ANATOLE ELEMENTAIRE</schoolName>
<phone>0561250508</phone>
<address>
<idStreet>1502</idStreet>
<num>21</num>
<street1>BD DE LA MEDITERRANEE</street1>
<town>TOULOUSE</town>
<zipcode>31400</zipcode>
</address>
<headmaster>HOONHORST SEBASTIEN</headmaster>
</perimSchoolList>
</perim>
<derogSchoolList>
<idSchool>2578</idSchool>
<schoolName>AMIDONNIERS ELEMENTAIRE</schoolName>
<phone>05 34 24 58 95</phone>
<address>
<idStreet>469</idStreet>
<num>123</num>
<street1>ALL DE BRIENNE</street1>
<town>TOULOUSE</town>
<zipcode>31000</zipcode>
</address>
<headmaster>TERRADA BENJAMIN</headmaster>
</derogSchoolList>
<derogSchoolList>
<idSchool>2578</idSchool>
<schoolName>AMIDONNIERS ELEMENTAIRE</schoolName>
<phone>05 34 24 58 95</phone>
<address>
<idStreet>469</idStreet>
<num>123</num>
<street1>ALL DE BRIENNE</street1>
<town>TOULOUSE</town>
<zipcode>31000</zipcode>
</address>
<headmaster>TERRADA BENJAMIN</headmaster>
</derogSchoolList>
<derogSchoolList>
<idSchool>2654</idSchool>
<schoolName>AUBRAC LUCIE ELEMENTAIRE</schoolName>
<phone>05 61 13 99 38</phone>
<address>
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<num>38</num>
</address>
<headmaster>WAIG FANG SANDRINE</headmaster>
</derogSchoolList>
</subscribeSchoolInformation>
<subscribeSchoolYearList>
<subscribeSchool>
<idSubscribe>S10053183070</idSubscribe>

View File

@ -4621,7 +4621,7 @@ def test_read_school_list_child_and_level(family_service, con, app):
assert 'text' in item
def test_read_child_school_subscription_information(family_service, con, app):
def test_read_child_school_informations(family_service, con, app):
family_service.add_soap_response(
'getChildSubscribeSchoolInformation', get_xml_file('R_get_child_subscribe_school_information.xml')
)
@ -4636,6 +4636,14 @@ def test_read_child_school_subscription_information(family_service, con, app):
assert 'rl1Info' in resp.json['data']
assert 'childSubscribeSchoolInformation' in resp.json['data']
assert 'personSubscribeSchoolList' in resp.json['data']
school_list = resp.json['data']['childSubscribeSchoolInformation']['subscribeSchoolInformation'][
'derogSchoolList'
]
assert [(x['id'], x['text']) for x in school_list] == [
('2578', 'AMIDONNIERS ELEMENTAIRE'),
('2578', 'AMIDONNIERS ELEMENTAIRE'),
('2654', 'AUBRAC LUCIE ELEMENTAIRE'),
]
def test_create_child_school_pre_registration(family_service, con, app):