toulouse-maelis: normalize direction referential (#86068)

This commit is contained in:
Nicolas Roche 2024-01-25 09:44:17 +01:00 committed by Nicolas Roche
parent c3557f628a
commit 509ae33314
2 changed files with 36 additions and 30 deletions

View File

@ -1063,6 +1063,20 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def read_dietcode_list(self, request, id=None, q=None, limit=None, distinct=True):
return {'data': self.get_referential('DietCode', id, q, limit, distinct)}
@endpoint(
display_category='Inscriptions',
description='Lister les directions de la ville',
name='read-direction-list',
parameters={
'id': {'description': 'Identifiant de lenregistrement'},
'q': {'description': 'Recherche en texte intégral'},
'limit': {'description': 'Nombre maximal de résultats; doit être inférieur à 20.'},
'distinct': {'description': 'Ne pas inclure les valeurs dupliquées'},
},
)
def read_direction_list(self, request, id=None, q=None, limit=None, distinct=True):
return {'data': self.get_referential('Direct', id, q, limit, distinct)}
@endpoint(
display_category='Famille',
description='Lister les pièces jointes',
@ -3355,14 +3369,6 @@ class ToulouseMaelis(BaseResource, HTTPResource):
groups[group['id']] = types
return {'data': data, 'meta': groups}
@endpoint(
display_category='Inscriptions',
description='Lister les directions de la ville',
name='read-direction-list',
)
def read_direction_list(self, request):
return {'data': self.get_referential('Direct')}
@endpoint(
display_category='Inscriptions',
description='Lister les indicateurs pour les activités petite enfance',

View File

@ -1077,7 +1077,28 @@ def test_read_csp_list(con, app):
]
def test_read_direct_list(con, app):
def test_read_dietcode_list(con, app):
url = get_endpoint('read-dietcode-list')
resp = app.get(url)
assert resp.json['err'] == 0
assert resp.json['data'] == [
{'id': 'STD', 'code': 'STD', 'text': '1- REPAS STANDARD', 'libelle': '1- REPAS STANDARD'},
{'id': 'RSP', 'code': 'RSP', 'text': '2- RÉGIME SANS PORC', 'libelle': '2- RÉGIME SANS PORC'},
{'id': 'RSV', 'code': 'RSV', 'text': '3- RÉGIME SANS VIANDE', 'libelle': '3- RÉGIME SANS VIANDE'},
{
'id': 'PAI',
'code': 'PAI',
'text': "4- PROTOCOLE D'ACCUEIL INDIVIDUALISÉ",
'libelle': "4- PROTOCOLE D'ACCUEIL INDIVIDUALISÉ",
},
{'id': 'BB', 'code': 'BB', 'text': 'REPAS BEBE', 'libelle': 'REPAS BEBE'},
{'id': 'MSP', 'code': 'MSP', 'text': 'REPAS MOYEN SANS PORC', 'libelle': 'REPAS MOYEN SANS PORC'},
{'id': 'MSV', 'code': 'MSV', 'text': 'REPAS MOYEN SANS VIANDE', 'libelle': 'REPAS MOYEN SANS VIANDE'},
{'id': 'MST', 'code': 'MST', 'text': 'REPAS MOYEN STANDARD', 'libelle': 'REPAS MOYEN STANDARD'},
]
def test_read_direction_list(con, app):
url = get_endpoint('read-direction-list')
resp = app.get(url)
assert resp.json['err'] == 0
@ -1106,27 +1127,6 @@ def test_read_direct_list(con, app):
]
def test_read_dietcode_list(con, app):
url = get_endpoint('read-dietcode-list')
resp = app.get(url)
assert resp.json['err'] == 0
assert resp.json['data'] == [
{'id': 'STD', 'code': 'STD', 'text': '1- REPAS STANDARD', 'libelle': '1- REPAS STANDARD'},
{'id': 'RSP', 'code': 'RSP', 'text': '2- RÉGIME SANS PORC', 'libelle': '2- RÉGIME SANS PORC'},
{'id': 'RSV', 'code': 'RSV', 'text': '3- RÉGIME SANS VIANDE', 'libelle': '3- RÉGIME SANS VIANDE'},
{
'id': 'PAI',
'code': 'PAI',
'text': "4- PROTOCOLE D'ACCUEIL INDIVIDUALISÉ",
'libelle': "4- PROTOCOLE D'ACCUEIL INDIVIDUALISÉ",
},
{'id': 'BB', 'code': 'BB', 'text': 'REPAS BEBE', 'libelle': 'REPAS BEBE'},
{'id': 'MSP', 'code': 'MSP', 'text': 'REPAS MOYEN SANS PORC', 'libelle': 'REPAS MOYEN SANS PORC'},
{'id': 'MSV', 'code': 'MSV', 'text': 'REPAS MOYEN SANS VIANDE', 'libelle': 'REPAS MOYEN SANS VIANDE'},
{'id': 'MST', 'code': 'MST', 'text': 'REPAS MOYEN STANDARD', 'libelle': 'REPAS MOYEN STANDARD'},
]
def test_read_document_list(con, app):
url = get_endpoint('read-document-list')
resp = app.get(url)