toulouse-maelis: add activity types data in read_activity_nature_list endpoint (#74447)
gitea/passerelle/pipeline/head Something is wrong with the build of this commit
Details
gitea/passerelle/pipeline/head Something is wrong with the build of this commit
Details
This commit is contained in:
parent
0c0b6fe72a
commit
224a2bda7b
|
@ -2624,7 +2624,21 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
perm='can_access',
|
||||
)
|
||||
def read_activity_nature_list(self, request):
|
||||
return {'data': self.get_referential('ActivityNatureType')}
|
||||
data = self.get_referential('ActivityNatureType')
|
||||
|
||||
groups = {}
|
||||
for group in data:
|
||||
types = []
|
||||
for item in group['activityTypeList']:
|
||||
types.append(
|
||||
{
|
||||
'id': item['code'],
|
||||
'text': item['libelle'],
|
||||
**item,
|
||||
}
|
||||
)
|
||||
groups[group['id']] = types
|
||||
return {'data': data, 'meta': groups}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
|
|
|
@ -5622,6 +5622,13 @@ def test_read_activity_nature_list(con, app):
|
|||
],
|
||||
}
|
||||
|
||||
assert [(x['id'], x['text']) for x in resp.json['meta']['A']] == [
|
||||
('ACCMAT', 'Accueil du matin'),
|
||||
('ACCMIDI', 'Accueil du mercredi'),
|
||||
('ACCPERI', 'Accueil périscolaire'),
|
||||
('ACCSOIR', 'Accueil du soir'),
|
||||
]
|
||||
|
||||
|
||||
def test_read_ape_indicator_list(con, app):
|
||||
url = get_endpoint('read-ape-indicators-list')
|
||||
|
|
Loading…
Reference in New Issue