toulouse-maelis: add direction and service referentials (#75812)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
parent
685014df6b
commit
3a558b0ba4
|
@ -199,9 +199,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
)
|
||||
|
||||
def update_activity_referentials(self):
|
||||
for referential_name in ('ActivityNatureType',):
|
||||
for referential_name in ('ActivityNatureType', 'Direct', 'Service'):
|
||||
id_key, text_key = 'code', 'libelle'
|
||||
data = self.get_referential_data('Activity', referential_name)
|
||||
if referential_name in ['Direct', 'Service']:
|
||||
id_key, text_key = 'id', 'lib1'
|
||||
self.update_referential(referential_name, data, id_key, text_key)
|
||||
|
||||
# put activity catalog per year as referential
|
||||
|
@ -2819,6 +2821,28 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
groups[group['id']] = types
|
||||
return {'data': data, 'meta': groups}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
description="Lister directions de la ville",
|
||||
name='read-direction-list',
|
||||
perm='can_access',
|
||||
)
|
||||
def read_direction_list(self, request):
|
||||
return {'data': self.get_referential('Direct')}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
description="Lister services de la ville",
|
||||
name='read-service-list',
|
||||
perm='can_access',
|
||||
parameters={'direction_id': {'description': "Numéro de la direction sur laquelle filtrer"}},
|
||||
)
|
||||
def read_service_list(self, request, direction_id=None):
|
||||
queryset = self.referential.filter(referential_name='Service')
|
||||
if direction_id:
|
||||
queryset = queryset.filter(item_data__idDir=direction_id)
|
||||
return {'data': [x.item_data for x in queryset]}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
description="Lister les indicateurs pour les activités petite enfance",
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:readDirectListResponse xmlns:ns2="activity.ws.maelis.sigec.com" xmlns:ns3="bean.persistence.activity.ws.maelis.sigec.com" xmlns:ns4="bean.persistence.school.ws.maelis.sigec.com">
|
||||
<DirectBean>
|
||||
<id>A10051141969</id>
|
||||
<lib1>DSCS SENIORS</lib1>
|
||||
<lib2>Direction des solidarités et de la cohésion sociale domaine</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10051141971</id>
|
||||
<lib1>DSCS CS</lib1>
|
||||
<lib2>Direction des solidarités et de la cohésion sociale centres</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327620</id>
|
||||
<lib1>CCAS</lib1>
|
||||
<lib2>Centre communal d'action social</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327621</id>
|
||||
<lib1>DASC</lib1>
|
||||
<lib2>Direction de l'action socioculturelle</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327622</id>
|
||||
<lib1>DEPP</lib1>
|
||||
<lib2>Direction de l'éducation prestations périscolaires</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327623</id>
|
||||
<lib1>DE SICS</lib1>
|
||||
<lib2>Direction éducation inscription et carte scolaire</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327624</id>
|
||||
<lib1>DEL</lib1>
|
||||
<lib2>Direction enfance et loisirs</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327625</id>
|
||||
<lib1>DPE</lib1>
|
||||
<lib2>Direction de la petite enfance</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327626</id>
|
||||
<lib1>DSBL</lib1>
|
||||
<lib2>Direction des sports et bases de loisirs</lib2>
|
||||
</DirectBean>
|
||||
<DirectBean>
|
||||
<id>A10049327627</id>
|
||||
<lib1>DSCS ACC JEUNES</lib1>
|
||||
<lib2>Direction des solidarités et de la cohésion sociale accueil</lib2>
|
||||
</DirectBean>
|
||||
</ns2:readDirectListResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,131 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:readServiceListResponse xmlns:ns2="activity.ws.maelis.sigec.com" xmlns:ns3="bean.persistence.activity.ws.maelis.sigec.com" xmlns:ns4="bean.persistence.school.ws.maelis.sigec.com">
|
||||
<ServiceBean>
|
||||
<id>A10049329048</id>
|
||||
<lib1>Accueils jeunes et centres sociaux</lib1>
|
||||
<idDir>A10049327627</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329049</id>
|
||||
<lib1>Ateliers</lib1>
|
||||
<idDir>A10049327621</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329042</id>
|
||||
<lib1>CCAS</lib1>
|
||||
<idDir>A10049327620</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329043</id>
|
||||
<lib1>Accueil de loisirs</lib1>
|
||||
<idDir>A10049327624</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329044</id>
|
||||
<lib1>Convoyages</lib1>
|
||||
<idDir>A10049327624</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329045</id>
|
||||
<lib1>Séjours vacances</lib1>
|
||||
<idDir>A10049327624</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329046</id>
|
||||
<lib1>Sports et bases de loisirs</lib1>
|
||||
<idDir>A10049327626</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329047</id>
|
||||
<lib1>Séniors</lib1>
|
||||
<idDir>A10049327627</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329050</id>
|
||||
<lib1>Stages</lib1>
|
||||
<idDir>A10049327621</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329051</id>
|
||||
<lib1>Sorties</lib1>
|
||||
<idDir>A10049327621</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329052</id>
|
||||
<lib1>Sorties culturelles et urbaines</lib1>
|
||||
<idDir>A10049327627</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329053</id>
|
||||
<lib1>Festivités</lib1>
|
||||
<idDir>A10049327627</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329054</id>
|
||||
<lib1>Activités numériques</lib1>
|
||||
<idDir>A10049327627</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049329055</id>
|
||||
<lib1>Restauration / portage</lib1>
|
||||
<idDir>A10049327627</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049327681</id>
|
||||
<lib1>RESTAURATION SCOLAIRE</lib1>
|
||||
<idDir>A10049327622</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049327685</id>
|
||||
<lib1>CLAE</lib1>
|
||||
<idDir>A10049327622</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049327695</id>
|
||||
<lib1>PARCOURS URBAIN</lib1>
|
||||
<idDir>A10049327622</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049327705</id>
|
||||
<lib1>GARDERIE</lib1>
|
||||
<idDir>A10049327622</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10054639474</id>
|
||||
<lib1>Structure Hors CApAJE (EPE, LAEP, ASSO...)</lib1>
|
||||
<idDir>A10049327625</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10054639473</id>
|
||||
<lib1>Structure CApAJE (EAJE hors mairie) </lib1>
|
||||
<idDir>A10049327625</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10051143887</id>
|
||||
<lib1>DE SICS</lib1>
|
||||
<idDir>A10049327623</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10051143888</id>
|
||||
<lib1>DSCS CS</lib1>
|
||||
<idDir>A10051141971</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10051143889</id>
|
||||
<lib1>DSCS SENIORS</lib1>
|
||||
<idDir>A10051141969</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049328220</id>
|
||||
<lib1>CLASSE DECOUVERTE</lib1>
|
||||
<idDir>A10049327622</idDir>
|
||||
</ServiceBean>
|
||||
<ServiceBean>
|
||||
<id>A10049328224</id>
|
||||
<lib1>Direction Petite Enfance (EAJE mairie)</lib1>
|
||||
<idDir>A10049327625</idDir>
|
||||
</ServiceBean>
|
||||
</ns2:readServiceListResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -215,6 +215,10 @@ def django_db_setup(django_db_setup, django_db_blocker):
|
|||
activity_mock.add_soap_response(
|
||||
'readActivityList', get_xml_file('R_read_activity_list.xml')
|
||||
)
|
||||
activity_mock.add_soap_response('readDirectList', get_xml_file('R_read_direct_list.xml'))
|
||||
activity_mock.add_soap_response(
|
||||
'readServiceList', get_xml_file('R_read_service_list.xml')
|
||||
)
|
||||
con.update_activity_referentials()
|
||||
|
||||
with ape_service() as ape_mock:
|
||||
|
@ -482,6 +486,7 @@ def test_cron(db):
|
|||
'Country',
|
||||
'DerogReason',
|
||||
'DietCode',
|
||||
'Direct',
|
||||
'Document',
|
||||
'Level',
|
||||
'Nursery',
|
||||
|
@ -492,6 +497,7 @@ def test_cron(db):
|
|||
'Quotient',
|
||||
'RLIndicator',
|
||||
'Regie',
|
||||
'Service',
|
||||
'Sex',
|
||||
'Situation',
|
||||
'Street',
|
||||
|
@ -675,6 +681,35 @@ def test_read_csp_list(con, app):
|
|||
]
|
||||
|
||||
|
||||
def test_read_direct_list(con, app):
|
||||
url = get_endpoint('read-direction-list')
|
||||
resp = app.get(url)
|
||||
assert resp.json['err'] == 0
|
||||
assert len(resp.json['data']) == 10
|
||||
assert resp.json['data'][:5] == [
|
||||
{'id': 'A10049327620', 'lib1': 'CCAS', 'lib2': "Centre communal d'action social", 'text': 'CCAS'},
|
||||
{
|
||||
'id': 'A10049327621',
|
||||
'lib1': 'DASC',
|
||||
'lib2': "Direction de l'action socioculturelle",
|
||||
'text': 'DASC',
|
||||
},
|
||||
{'id': 'A10049327624', 'lib1': 'DEL', 'lib2': 'Direction enfance et loisirs', 'text': 'DEL'},
|
||||
{
|
||||
'id': 'A10049327622',
|
||||
'lib1': 'DEPP',
|
||||
'lib2': "Direction de l'éducation prestations périscolaires",
|
||||
'text': 'DEPP',
|
||||
},
|
||||
{
|
||||
'id': 'A10049327623',
|
||||
'lib1': 'DE SICS',
|
||||
'lib2': 'Direction éducation inscription et carte scolaire',
|
||||
'text': 'DE SICS',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def test_read_dietcode_list(con, app):
|
||||
url = get_endpoint('read-dietcode-list')
|
||||
resp = app.get(url)
|
||||
|
@ -849,6 +884,63 @@ def test_read_rl_indicator_list(con, app):
|
|||
]
|
||||
|
||||
|
||||
def test_read_service_list(con, app):
|
||||
url = get_endpoint('read-service-list')
|
||||
resp = app.get(url)
|
||||
assert resp.json['err'] == 0
|
||||
assert len(resp.json['data']) == 25
|
||||
assert resp.json['data'][:5] == [
|
||||
{
|
||||
'id': 'A10049329043',
|
||||
'lib1': 'Accueil de loisirs',
|
||||
'lib2': None,
|
||||
'text': 'Accueil de loisirs',
|
||||
'idDir': 'A10049327624',
|
||||
},
|
||||
{
|
||||
'id': 'A10049329048',
|
||||
'lib1': 'Accueils jeunes et centres sociaux',
|
||||
'lib2': None,
|
||||
'text': 'Accueils jeunes et centres sociaux',
|
||||
'idDir': 'A10049327627',
|
||||
},
|
||||
{
|
||||
'id': 'A10049329054',
|
||||
'lib1': 'Activités numériques',
|
||||
'lib2': None,
|
||||
'text': 'Activités numériques',
|
||||
'idDir': 'A10049327627',
|
||||
},
|
||||
{'id': 'A10049329049', 'lib1': 'Ateliers', 'lib2': None, 'text': 'Ateliers', 'idDir': 'A10049327621'},
|
||||
{'id': 'A10049329042', 'lib1': 'CCAS', 'lib2': None, 'text': 'CCAS', 'idDir': 'A10049327620'},
|
||||
]
|
||||
|
||||
resp = app.get(url + '?direction_id=A10049327624')
|
||||
assert resp.json['data'] == [
|
||||
{
|
||||
'id': 'A10049329043',
|
||||
'lib1': 'Accueil de loisirs',
|
||||
'lib2': None,
|
||||
'text': 'Accueil de loisirs',
|
||||
'idDir': 'A10049327624',
|
||||
},
|
||||
{
|
||||
'id': 'A10049329044',
|
||||
'lib1': 'Convoyages',
|
||||
'lib2': None,
|
||||
'text': 'Convoyages',
|
||||
'idDir': 'A10049327624',
|
||||
},
|
||||
{
|
||||
'id': 'A10049329045',
|
||||
'lib1': 'Séjours vacances',
|
||||
'lib2': None,
|
||||
'text': 'Séjours vacances',
|
||||
'idDir': 'A10049327624',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def test_read_sex_list(con, app):
|
||||
url = get_endpoint('read-sex-list')
|
||||
resp = app.get(url)
|
||||
|
|
Loading…
Reference in New Issue