toulouse-maelis: add professional situation referential (#74195)

This commit is contained in:
Nicolas Roche 2023-02-05 18:41:14 +01:00 committed by Gitea
parent 14580168e1
commit dc0666eb39
3 changed files with 70 additions and 1 deletions

View File

@ -140,6 +140,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'Document',
'Organ',
'PAI',
'ProfessionalSituation',
'Quality',
'Quotient',
'RLIndicator',
@ -703,7 +704,22 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description='lister les qualités du référenciel',
description="Lister les situations professionnelles",
name='read-professional-situation-list',
perm='can_access',
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': 'Supression des doublons'},
},
)
def read_professional_situation_list(self, request, id=None, q=None, limit=None, distinct=True):
return {'data': self.get_referential('ProfessionalSituation', id, q, limit, distinct)}
@endpoint(
display_category='Famille',
description='lister les qualités',
name='read-quality-list',
perm='can_access',
parameters={

View File

@ -0,0 +1,34 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:readProfessionalSituationListResponse xmlns:ns2="family.ws.maelis.sigec.com">
<itemList>
<code>01</code>
<libelle>Activité professionnelle</libelle>
</itemList>
<itemList>
<code>06</code>
<libelle>Autre</libelle>
</itemList>
<itemList>
<code>05</code>
<libelle>Congé parental</libelle>
</itemList>
<itemList>
<code>04</code>
<libelle>Etudiant</libelle>
</itemList>
<itemList>
<code>03</code>
<libelle>Formation</libelle>
</itemList>
<itemList>
<code>07</code>
<libelle>Intérim</libelle>
</itemList>
<itemList>
<code>02</code>
<libelle>Recherche d'emploi</libelle>
</itemList>
</ns2:readProfessionalSituationListResponse>
</soap:Body>
</soap:Envelope>

View File

@ -172,6 +172,9 @@ def django_db_setup(django_db_setup, django_db_blocker):
soap_mock.add_soap_response('readDocumentList', get_xml_file('R_read_document_list.xml'))
soap_mock.add_soap_response('readOrganList', get_xml_file('R_read_organ_list.xml'))
soap_mock.add_soap_response('readPAIList', get_xml_file('R_read_pai_list.xml'))
soap_mock.add_soap_response(
'readProfessionalSituationList', get_xml_file('R_read_professional_situation_list.xml')
)
soap_mock.add_soap_response('readQualityList', get_xml_file('R_read_quality_list.xml'))
soap_mock.add_soap_response('readQuotientList', get_xml_file('R_read_quotient_list.xml'))
soap_mock.add_soap_response('readRLIndicatorList', get_xml_file('R_read_rl_indicator_list.xml'))
@ -393,6 +396,7 @@ def test_cron(db):
'Nursery',
'Organ',
'PAI',
'ProfessionalSituation',
'Quality',
'Quotient',
'RLIndicator',
@ -659,6 +663,21 @@ def test_read_pai_list(con, app):
]
def test_read_professiona_situation_list(con, app):
url = get_endpoint('read-professional-situation-list')
resp = app.get(url)
assert resp.json['err'] == 0
assert resp.json['data'] == [
{'id': '01', 'code': '01', 'text': 'Activité professionnelle', 'libelle': 'Activité professionnelle'},
{'id': '06', 'code': '06', 'text': 'Autre', 'libelle': 'Autre'},
{'id': '05', 'code': '05', 'text': 'Congé parental', 'libelle': 'Congé parental'},
{'id': '04', 'code': '04', 'text': 'Etudiant', 'libelle': 'Etudiant'},
{'id': '03', 'code': '03', 'text': 'Formation', 'libelle': 'Formation'},
{'id': '07', 'code': '07', 'text': 'Intérim', 'libelle': 'Intérim'},
{'id': '02', 'code': '02', 'text': "Recherche d'emploi", 'libelle': "Recherche d'emploi"},
]
def test_read_quality_list(con, app):
url = get_endpoint('read-quality-list')
resp = app.get(url)