toulouse-maelis: add new professional fields to DUI (#74195)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details
gitea/passerelle/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Nicolas Roche 2023-02-05 18:43:26 +01:00 committed by Gitea
parent dc0666eb39
commit ed05841b58
7 changed files with 56 additions and 0 deletions

View File

@ -296,6 +296,14 @@ PROFESSION_SCHEMA = {
'description': 'Téléphone',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'situation': {
'description': 'Code de la situation professionnelle (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'weeklyHours': {
'description': "horaires de travail hebdomadaire",
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'addressPro': ADDRESSPROF_SCHEMA,
},
}

View File

@ -331,6 +331,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.add_text_value('Complement', data, ['adresse', 'numComp'])
self.add_text_value('Street', data, ['adresse', 'idStreet'])
self.add_text_value('CSP', data, ['profession', 'codeCSP'])
self.add_text_value('ProfessionalSituation', data, ['profession', 'situation'])
self.add_text_value('Organ', data, ['CAFInfo', 'organ'])
for indicator in data['indicatorList']:
self.add_text_value_to_rl_indicator(indicator)
@ -481,6 +482,9 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.assert_post_data_in_referential(
'CSP', post_data, keys + ['profession', 'codeCSP'], required=False
)
self.assert_post_data_in_referential(
'ProfessionalSituation', post_data, keys + ['profession', 'situation'], required=False
)
self.assert_post_data_in_referential('Organ', post_data, keys + ['CAFInfo', 'organ'], required=False)
data = post_data

View File

@ -92,6 +92,8 @@
<addressPro>
<town>Orl&#233;ans</town>
</addressPro>
<situation>01</situation>
<weeklyHours>9h-18h</weeklyHours>
</profession>
<CAFInfo>
<number>789</number>

View File

@ -92,6 +92,8 @@
<addressPro>
<town>Orl&#233;ans</town>
</addressPro>
<situation>01</situation>
<weeklyHours>9h-18h</weeklyHours>
</profession>
<CAFInfo>
<number>789</number>

View File

@ -92,6 +92,8 @@
<addressPro>
<town>Orl&#233;ans</town>
</addressPro>
<situation>01</situation>
<weeklyHours>9h-18h</weeklyHours>
</profession>
<CAFInfo>
<number>789</number>

View File

@ -76,6 +76,8 @@
<addressPro>
<town>Orl&#233;ans</town>
</addressPro>
<situation>01</situation>
<weeklyHours>9h-18h</weeklyHours>
</profession>
<CAFInfo>
<number>789</number>

View File

@ -1325,6 +1325,9 @@ def test_read_rl2(family_service, con, app):
'phone': '0123456789',
'addressPro': {'num': None, 'street': None, 'zipcode': None, 'town': 'Orléans'},
'codeCSP_text': 'ARTISAN',
'situation': '01',
'situation_text': 'Activité professionnelle',
'weeklyHours': '9h-18h',
},
'CAFInfo': {
'number': '789',
@ -1565,6 +1568,7 @@ def test_create_family(family_service, con, app):
'rl1/adresse/numComp': 'B',
'rl1/contact/isContactMail': True,
'rl1/profession/codeCSP': 'ART',
'rl1/profession/situation': '01',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/civility': 'MME',
'emergencyPersonList/0/firstname': 'Keny',
@ -1684,6 +1688,7 @@ def test_create_family_wrong_referential_key_error(con, app):
'rl1/adresse/zipcode': '75014',
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/profession/situation': '01',
'rl1/CAFInfo/organ': 'A10007752822',
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
@ -1704,6 +1709,15 @@ def test_create_family_wrong_referential_key_error(con, app):
== "childList/0/medicalRecord/vaccinList/0/code key value 'plop' do not belong to 'Vaccin' referential"
)
params['childList/0/medicalRecord/vaccinList/0/code'] = 'DTC'
params['rl1/profession/situation'] = 'plop'
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "rl1/profession/situation key value 'plop' do not belong to 'ProfessionalSituation' referential"
)
def test_update_family(family_service, con, app):
def request_check(request):
@ -1729,6 +1743,7 @@ def test_update_family(family_service, con, app):
'rl1/adresse/zipcode': '75014',
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/profession/situation': '01',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/civility': 'MME',
'emergencyPersonList/0/firstname': 'Keny',
@ -1849,6 +1864,7 @@ def test_update_family_wrong_referential_key_error(con, app):
'rl1/adresse/zipcode': '75014',
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/profession/situation': '01',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/civility': 'MME',
'emergencyPersonList/0/firstname': 'Keny',
@ -1875,6 +1891,15 @@ def test_update_family_wrong_referential_key_error(con, app):
== "childList/0/medicalRecord/vaccinList/0/code key value 'plop' do not belong to 'Vaccin' referential"
)
params['childList/0/medicalRecord/vaccinList/0/code'] = 'DTC'
params['rl1/profession/situation'] = 'plop'
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "rl1/profession/situation key value 'plop' do not belong to 'ProfessionalSituation' referential"
)
def test_create_rl1(family_service, con, app):
family_service.add_soap_response('createFamily', get_xml_file('R_create_family.xml'))
@ -2493,6 +2518,8 @@ def test_update_coordinate(family_service, con, app):
'adresse/zipcode': '75014',
'contact/isContactMail': True,
'profession/codeCSP': 'ART',
'profession/situation': '01',
'profession/weeklyHours': '9h-18h',
'profession/profession': 'informaticien',
'profession/employerName': 'EO',
'profession/phone': '0123456789',
@ -2549,6 +2576,15 @@ def test_update_coordinate_wrong_referential_key_error(con, app):
resp.json['err_desc'] == "adresse/numComp key value 'plop' do not belong to 'Complement' referential"
)
params['adresse/numComp'] = 'B'
params['profession/situation'] = 'plop'
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "profession/situation key value 'plop' do not belong to 'ProfessionalSituation' referential"
)
def test_update_quotient(family_service, con, app):
family_service.add_soap_response('createUpdateQuotient', get_xml_file('R_create_update_quotient.xml'))