toulouse-maelis: add endpoint to list nurseries (#73924) #79
|
@ -170,10 +170,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
self.update_referential(referential_name, data, id_key, text_key)
|
||||
|
||||
def update_ape_referentials(self):
|
||||
for referential_name in ('ApeIndicator',):
|
||||
id_key, text_key = 'level', 'level'
|
||||
data = self.get_referential_data('Ape', referential_name)
|
||||
self.update_referential(referential_name, data, id_key, text_key)
|
||||
indicators = self.call('Ape', 'readApeIndicatorList')
|
||||
self.update_referential('ApeIndicator', serialize_object(indicators), 'level', 'level')
|
||||
|
||||
nurseries = self.call('Ape', 'readNurseryList', request={})
|
||||
self.update_referential('Nursery', serialize_object(nurseries), 'idActivity', 'libelle')
|
||||
|
||||
def daily(self):
|
||||
try:
|
||||
|
@ -2651,6 +2652,24 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
)
|
||||
return {'data': serialize_object(response)}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
description="Liste les crèches",
|
||||
name='read-nursery-list',
|
||||
perm='can_access',
|
||||
parameters={
|
||||
'activity_type': {'description': 'Type d\'activité.', 'example_value': 'CRECHCO'},
|
||||
'code_psu': {'description': 'Code PSU.', 'example_value': 'REGULAR'},
|
||||
},
|
||||
)
|
||||
def read_nursery_list(self, request, activity_type=None, code_psu=None):
|
||||
nurseries = self.get_referential('Nursery')
|
||||
if activity_type:
|
||||
nurseries = [n for n in nurseries if n['activityType']['code'] == activity_type]
|
||||
if code_psu:
|
||||
nurseries = [n for n in nurseries if code_psu in [u['typeAcc'] for u in n['unitList']]]
|
||||
return {'data': nurseries}
|
||||
|
||||
|
||||
class Link(models.Model):
|
||||
resource = models.ForeignKey(ToulouseMaelis, on_delete=models.CASCADE)
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:readNurseryListResponse xmlns:ns2="ape.ws.maelis.sigec.com">
|
||||
<result>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000004</idActivity><libelle>CC BOULE DE GOMME</libelle>
|
||||
<manager1>
|
||||
<lastname>SARRIMANE</lastname><firstname>Valerie</firstname><phone>05 61 62 08 49</phone><poste>ASSO</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 1.3</obs1><obs2>Secteur 1</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180335</idUnit><libelle>CC BOULE DE GOMME - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180336</idUnit><libelle>CC BOULE DE GOMME - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180334</idPlace><libelle>CC BOULE DE GOMME</libelle>
|
||||
<address>
|
||||
<num>31</num><street1>RUE ROQUELAINE</street1><zipcode>31000</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000005</idActivity><libelle>CC C.A.P.P.E.</libelle>
|
||||
<manager1>
|
||||
<lastname>CALAZEL</lastname><firstname>Régine</firstname><phone>05 61 55 46 50</phone><poste>ASSO</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 5.3</obs1><obs2>Secteur 5</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180338</idUnit><libelle>CC C.A.P.P.E. - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180339</idUnit><libelle>CC C.A.P.P.E. - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180337</idPlace><libelle>CC C.A.P.P.E.</libelle>
|
||||
<address>
|
||||
<num>1</num><street1>IMP DES HERONS</street1><zipcode>31400</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000202</idActivity><libelle>Relais Petite Enfance PRADETTES</libelle>
|
||||
<manager1>
|
||||
<lastname>BUSTAMENTE</lastname><firstname>Joëlle</firstname><phone>05 61 22 36 20</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 6.2</obs1><obs2>Secteur 6</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180930</idUnit><libelle>Relais Petite Enfance PRADETTES - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180928</idPlace><libelle>Relais Petite Enfance PRADETTES</libelle>
|
||||
<address>
|
||||
<num>12</num><street1>CHE DES PRADETTES</street1><zipcode>31100</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000203</idActivity><libelle>Relais Petite Enfance REPUBLIQUE</libelle>
|
||||
<manager1>
|
||||
<lastname>LEHMANN</lastname><firstname>Valérie</firstname><phone>05 34 55 78 06</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 2.1</obs1><obs2>Secteur 2</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180932</idUnit><libelle>Relais Petite Enfance REPUBLIQUE - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180933</idUnit><libelle>Relais Petite Enfance REPUBLIQUE - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180931</idPlace><libelle>Relais Petite Enfance REPUBLIQUE</libelle>
|
||||
<address>
|
||||
<num>48</num><street1>RUE DE LA REPUBLIQUE</street1><zipcode>31300</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000204</idActivity><libelle>SECTEUR 1</libelle><obs2>Secteur 1</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180935</idUnit><libelle>SECTEUR 1 - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180936</idUnit><libelle>SECTEUR 1 - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180934</idPlace><libelle>SECTEUR 1</libelle>
|
||||
<address>
|
||||
<num>1</num><street1>RUE DE SEBASTOPOL</street1><zipcode>31000</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000205</idActivity><libelle>SECTEUR 2</libelle><obs2>Secteur 2</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180939</idUnit><libelle>SECTEUR 2 - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180937</idPlace><libelle>SECTEUR 2</libelle>
|
||||
<address>
|
||||
<num>1</num><street1>RUE DE SEBASTOPOL</street1><zipcode>31000</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHCO</code><libelle>Crèche collective</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000206</idActivity><libelle>SECTEUR 3</libelle><obs2>Secteur 3</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180941</idUnit><libelle>SECTEUR 3 - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180942</idUnit><libelle>SECTEUR 3 - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180940</idPlace><libelle>SECTEUR 3</libelle>
|
||||
<address>
|
||||
<num>1</num><street1>RUE DE SEBASTOPOL</street1><zipcode>31000</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHFAM</code><libelle>Crèche familiale</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000050</idActivity><libelle>C. FAMILIALE CARTOUCHERIE</libelle>
|
||||
<manager1>
|
||||
<lastname>PLANET</lastname><firstname>LAURENCE</firstname><phone>05 81 91 79 99</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 2.4</obs1><obs2>Secteur 2</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180473</idUnit><libelle>C. FAMILIALE CARTOUCHERIE - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180474</idUnit><libelle>C. FAMILIALE CARTOUCHERIE - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180472</idPlace><libelle>C. FAMILIALE CARTOUCHERIE</libelle>
|
||||
<address>
|
||||
<num>5</num><street1>RUE MARIE DE GOURNAY</street1><zipcode>31300</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHFAM</code><libelle>Crèche familiale</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000051</idActivity><libelle>C. FAMILIALE GERMAINE CHAUMEL</libelle>
|
||||
<manager1>
|
||||
<lastname>FRADET</lastname><firstname>FREDERIQUE</firstname><phone>05 34 40 70 59</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 3.1</obs1><obs2>Secteur 3</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180476</idUnit><libelle>C. FAMILIALE GERMAINE CHAUMEL - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<unitList>
|
||||
<idUnit>M10053180477</idUnit><libelle>C. FAMILIALE GERMAINE CHAUMEL - Occasionnels</libelle><typeAcc>OCCASIONAL</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180475</idPlace><libelle>C. FAMILIALE GERMAINE CHAUMEL</libelle>
|
||||
<address>
|
||||
<num>5</num><street1>PL STEPHANE HESSEL</street1><zipcode>31200</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
<nurseryList>
|
||||
<activityType>
|
||||
<code>CRECHFAM</code><libelle>Crèche familiale</libelle>
|
||||
</activityType>
|
||||
<idActivity>M10000000054</idActivity><libelle>C. FAMILIALE LAMPÀGIA</libelle>
|
||||
<manager1>
|
||||
<lastname>PELLIZZARI</lastname><firstname>SOPHIE</firstname><phone>05 31 22 98 65</phone><poste>VT</poste>
|
||||
</manager1>
|
||||
<obs1>Quartier 3.3</obs1><obs2>Secteur 3</obs2>
|
||||
<unitList>
|
||||
<idUnit>M10053180485</idUnit><libelle>C. FAMILIALE LAMPÀGIA - Réguliers</libelle><typeAcc>REGULAR</typeAcc>
|
||||
</unitList>
|
||||
<place>
|
||||
<idPlace>M10053180484</idPlace><libelle>C. FAMILIALE LAMPÀGIA</libelle>
|
||||
<address>
|
||||
<num>95</num><street1>RUE ERNEST RENAN</street1><zipcode>31200</zipcode><town>TOULOUSE</town>
|
||||
</address>
|
||||
</place>
|
||||
</nurseryList>
|
||||
</result>
|
||||
</ns2:readNurseryListResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -190,6 +190,7 @@ def django_db_setup(django_db_setup, django_db_blocker):
|
|||
|
||||
with ape_service() as ape_mock:
|
||||
ape_mock.add_soap_response('readApeIndicatorList', get_xml_file('R_read_ape_indicator_list.xml'))
|
||||
ape_mock.add_soap_response('readNurseryList', get_xml_file('R_read_nursery_list.xml'))
|
||||
con.update_ape_referentials()
|
||||
|
||||
# reset change in zeep private interface to bypass clear_cache fixture
|
||||
|
@ -363,6 +364,7 @@ def test_cron(db):
|
|||
'DietCode',
|
||||
'Document',
|
||||
'Level',
|
||||
'Nursery',
|
||||
'Organ',
|
||||
'PAI',
|
||||
'Quality',
|
||||
|
@ -5942,3 +5944,19 @@ def test_validate_basket_not_found(activity_service, con, app):
|
|||
resp = app.post(url + '?family_id=311352')
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == "no basket on '311352' family"
|
||||
|
||||
|
||||
def test_read_nursery_list(con, app):
|
||||
url = get_endpoint('read-nursery-list')
|
||||
resp = app.get(url)
|
||||
assert resp.json['err'] == 0
|
||||
assert len(resp.json['data']) == 10
|
||||
for item in resp.json['data']:
|
||||
assert 'id' in item
|
||||
assert 'text' in item
|
||||
|
||||
resp = app.get(url, params={'activity_type': 'CRECHCO'})
|
||||
assert len(resp.json['data']) == 7
|
||||
|
||||
resp = app.get(url, params={'code_psu': 'REGULAR'})
|
||||
assert len(resp.json['data']) == 8
|
||||
|
|
Loading…
Reference in New Issue