lille urban card: add endpoint with socioprofessional categories (#35500)
This commit is contained in:
parent
84e2c9bb68
commit
39529a72e0
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# passerelle - uniform access to multiple data sources and services
|
||||
# Copyright (C) 2019 Entr'ouvert
|
||||
#
|
||||
|
@ -62,6 +64,24 @@ class LilleUrbanCard(BaseResource):
|
|||
raise TokenError(response['erreur'])
|
||||
return response['token']
|
||||
|
||||
@endpoint(description=_('List of socioprofessional categories'))
|
||||
def csp(self, request, *args, **kwargs):
|
||||
return {'data': [
|
||||
{'id': '2', 'text': "Commerçant·e, chef·ffe d’entreprise"},
|
||||
{'id': '3', 'text': "Cadre, profession libérale ou intellectuel·le"},
|
||||
{'id': '4', 'text': "Profession intermédiaire"},
|
||||
{'id': '5', 'text': "Employé·e"},
|
||||
{'id': '6', 'text': "Ouvrier·e"},
|
||||
{'id': '1', 'text': "Agriculteur·rice"},
|
||||
{'id': '8', 'text': "Sans profession"},
|
||||
{'id': '81', 'text': "Demandeur·se d’emploi"},
|
||||
{'id': '82', 'text': "Enfant de 0 à 11 ans"},
|
||||
{'id': '83', 'text': "Enfant de plus de 12 ans"},
|
||||
{'id': '84', 'text': "Étudiant·e"},
|
||||
{'id': '7', 'text': "Retraité·e"},
|
||||
{'id': '99', 'text': "Ne souhaite pas se prononcer"},
|
||||
]}
|
||||
|
||||
@endpoint(perm='can_access', description=_('Card Request'), methods=['post'])
|
||||
def card_request(self, request, *args, **kwargs):
|
||||
data = json.loads(request.body)
|
||||
|
|
|
@ -43,6 +43,11 @@ def test_get_token(mocked_post, app, connector):
|
|||
connector.get_token()
|
||||
|
||||
|
||||
def test_csp(app, connector):
|
||||
endpoint = utils.generic_endpoint_url('lille-urban-card', 'csp', slug=connector.slug)
|
||||
resp = app.get(endpoint)
|
||||
assert resp.json.get('data')
|
||||
|
||||
def test_card_request(app, connector):
|
||||
endpoint = utils.generic_endpoint_url('lille-urban-card', 'card_request', slug=connector.slug)
|
||||
with HTTMock(mocked_http):
|
||||
|
|
Loading…
Reference in New Issue