toulouse-maelis: correct family payload check (#70851)

This commit is contained in:
Nicolas Roche 2022-10-23 14:59:16 +02:00
parent 82136bbce6
commit c25007919b
3 changed files with 27 additions and 2 deletions

View File

@ -342,8 +342,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
for rlg in 'rl1', 'rl2':
if rlg in post_data:
self.assert_rl_payload_in_referential(post_data, [rlg])
for i in range(0, len(post_data.get('emergencyPersonList') or [])):
self.assert_person_payload_in_referential(post_data, ['emergencyPersonList', i])
for i, person in enumerate(post_data.get('emergencyPersonList') or []):
for j in range(0, len(person.get('personList') or [])):
self.assert_person_payload_in_referential(
post_data, ['emergencyPersonList', i, 'personList', j]
)
for i in range(0, len(post_data.get('childList') or [])):
self.assert_child_payload_in_referential(post_data, ['childList', i])

View File

@ -50,6 +50,16 @@
<code>PAIALI</code>
</paiInfoBean>
</childList>
<emergencyPersonList>
<personList>
<civility>MME</civility>
<firstname>Keny</firstname>
<lastname>Arkana</lastname>
<dateBirth>1982-12-20</dateBirth>
<sexe>F</sexe>
<quality>T</quality>
</personList>
</emergencyPersonList>
</ns0:updateFamily>
</soap-env:Body>
</soap-env:Envelope>

View File

@ -1234,6 +1234,12 @@ def test_update_family(mocked_post, mocked_get, con, app):
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/personList/0/civility': 'MME',
'emergencyPersonList/0/personList/0/firstname': 'Keny',
'emergencyPersonList/0/personList/0/lastname': 'Arkana',
'emergencyPersonList/0/personList/0/sexe': 'F',
'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
'emergencyPersonList/0/personList/0/quality': 'T',
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
'childList/0/sexe': 'M',
@ -1354,6 +1360,12 @@ def test_update_family_wrong_referential_key_error(mocked_post, mocked_get, con,
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/personList/0/civility': 'MME',
'emergencyPersonList/0/personList/0/firstname': 'Keny',
'emergencyPersonList/0/personList/0/lastname': 'Arkana',
'emergencyPersonList/0/personList/0/sexe': 'F',
'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
'emergencyPersonList/0/personList/0/quality': 'T',
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
'childList/0/sexe': 'M',