toulouse-maelis: manage child insurance (#71696)
gitea-wip/passerelle/pipeline/pr-main This commit looks good
Details
gitea-wip/passerelle/pipeline/pr-main This commit looks good
Details
This commit is contained in:
parent
7b69192603
commit
09bde8b4b1
|
@ -370,6 +370,15 @@ def create_data(request, conn):
|
|||
for child in create_family_payload['childList']:
|
||||
child['lastname'] = lastname
|
||||
|
||||
# test insurance here because it cannot be reset
|
||||
create_family_payload['childList'][0]['insurance'] = {
|
||||
'company': 'Total Disaster Insurance',
|
||||
'contractNumber': '123',
|
||||
'memberNumber': '456',
|
||||
'contractStart': '2022-01-01',
|
||||
'contractEnd': '2022-12-31',
|
||||
}
|
||||
|
||||
url = conn + '/create-family?NameID=%s' % name_id
|
||||
resp = requests.post(url, json=create_family_payload)
|
||||
resp.raise_for_status()
|
||||
|
@ -381,9 +390,10 @@ def create_data(request, conn):
|
|||
return {
|
||||
'name_id': name_id, # linked
|
||||
'family_id': str(create_result['data']['number']),
|
||||
'family_payload': create_family_payload,
|
||||
'lastname': lastname,
|
||||
'rl1_num': data['RL1']['num'],
|
||||
'family_payload': create_family_payload,
|
||||
'bart_num': data['childList'][0]['num'],
|
||||
'data': data,
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,13 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"insurance": null,
|
||||
"insurance": {
|
||||
"company": "Total Disaster Insurance",
|
||||
"contractNumber": "123",
|
||||
"memberNumber": "456",
|
||||
"contractStart": "2022-01-01T00:00:00+01:00",
|
||||
"contractEnd": "2022-12-31T00:00:00+01:00"
|
||||
},
|
||||
"paiInfoBean": {
|
||||
"code": "PAIMED",
|
||||
"dateDeb": "2022-09-01T00:00:00+02:00",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"company": "Armagedon Colapse",
|
||||
"contractNumber": "444",
|
||||
"memberNumber": "555",
|
||||
"contractStart": "2022-01-02T00:00:00+01:00",
|
||||
"contractEnd": "2022-12-31T00:00:00+01:00"
|
||||
}
|
|
@ -552,6 +552,27 @@ def test_update_child(conn, update_data, create_data):
|
|||
assert resp.json()['err'] == 0
|
||||
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
|
||||
|
||||
# update Bart insurance (on create_data as it cannot be reset)
|
||||
unlink(conn, create_data['name_id'])
|
||||
link(conn, create_data)
|
||||
payload = copy.deepcopy(create_data['family_payload']['childList'][0])
|
||||
for key in 'dietcode', 'paiInfoBean', 'medicalRecord', 'authorizedPersonList', 'indicatorList':
|
||||
if key in payload:
|
||||
del payload[key]
|
||||
payload['insurance'] = {
|
||||
'company': 'Armagedon Colapse',
|
||||
'contractNumber': '444',
|
||||
'memberNumber': '555',
|
||||
'contractStart': '2022-01-02',
|
||||
'contractEnd': '2022-12-31',
|
||||
}
|
||||
url = conn + '/update-child?NameID=%s&child_id=%s' % (create_data['name_id'], create_data['bart_num'])
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res['err'] == 0
|
||||
assert diff_child(conn, create_data['name_id'], 0, 'test_update_child_insurance.json', 'insurance')
|
||||
|
||||
|
||||
def test_update_child_dietcode(conn, update_data):
|
||||
unlink(conn, update_data['name_id'])
|
||||
|
|
|
@ -499,6 +499,37 @@ PAIINFO_SCHEMA = {
|
|||
'additionalProperties': False,
|
||||
}
|
||||
|
||||
INSURANCE_SCHEMA = {
|
||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||
'title': 'Insurace',
|
||||
'description': "Informations sur l'assurance",
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'company': {
|
||||
'description': "Compagnie d'assurrance",
|
||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||
},
|
||||
'contractNumber': {
|
||||
'description': 'Numéro du contrat',
|
||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||
},
|
||||
'memberNumber': {
|
||||
'description': 'Numéro de membre',
|
||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||
},
|
||||
'contractStart': {
|
||||
'description': 'Date de début du contrat',
|
||||
'type': 'string',
|
||||
'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
|
||||
},
|
||||
'contractEnd': {
|
||||
'description': 'Date de fin du contrat',
|
||||
'type': 'string',
|
||||
'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
CHILD_SCHEMA = {
|
||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||
'title': 'Child',
|
||||
|
@ -530,6 +561,7 @@ CHILD_SCHEMA = {
|
|||
},
|
||||
'medicalRecord': {'oneOf': [MEDICALRECORD_SCHEMA, {'type': 'null'}]},
|
||||
'paiInfoBean': {'oneOf': [PAIINFO_SCHEMA, {'type': 'null'}]},
|
||||
'insurance': {'oneOf': [INSURANCE_SCHEMA, {'type': 'null'}]},
|
||||
'authorizedPersonList': {
|
||||
'oneOf': [
|
||||
{
|
||||
|
|
|
@ -185,6 +185,13 @@
|
|||
<vaccinationDate>1970-01-11T00:00:00+01:00</vaccinationDate>
|
||||
</vaccinList>
|
||||
</medicalRecord>
|
||||
<insurance>
|
||||
<company>Total Disaster Insurance</company>
|
||||
<contractNumber>123</contractNumber>
|
||||
<memberNumber>456</memberNumber>
|
||||
<contractStart>2022-01-01T00:00:00+01:00</contractStart>
|
||||
<contractEnd>2022-12-31T00:00:00+01:00</contractEnd>
|
||||
</insurance>
|
||||
<mother>
|
||||
<num>613963</num>
|
||||
<civility>MME</civility>
|
||||
|
|
|
@ -185,6 +185,13 @@
|
|||
<vaccinationDate>1970-01-11T00:00:00+01:00</vaccinationDate>
|
||||
</vaccinList>
|
||||
</medicalRecord>
|
||||
<insurance>
|
||||
<company>Total Disaster Insurance</company>
|
||||
<contractNumber>123</contractNumber>
|
||||
<memberNumber>456</memberNumber>
|
||||
<contractStart>2022-01-01T00:00:00+01:00</contractStart>
|
||||
<contractEnd>2022-12-31T00:00:00+01:00</contractEnd>
|
||||
</insurance>
|
||||
<mother>
|
||||
<num>613963</num>
|
||||
<civility>MME</civility>
|
||||
|
|
|
@ -185,6 +185,13 @@
|
|||
<vaccinationDate>1970-01-11T00:00:00+01:00</vaccinationDate>
|
||||
</vaccinList>
|
||||
</medicalRecord>
|
||||
<insurance>
|
||||
<company>Total Disaster Insurance</company>
|
||||
<contractNumber>123</contractNumber>
|
||||
<memberNumber>456</memberNumber>
|
||||
<contractStart>2022-01-01T00:00:00+01:00</contractStart>
|
||||
<contractEnd>2022-12-31T00:00:00+01:00</contractEnd>
|
||||
</insurance>
|
||||
<mother>
|
||||
<num>613963</num>
|
||||
<civility>MME</civility>
|
||||
|
|
|
@ -904,7 +904,13 @@ def test_read_family(family_service, xml, con, app):
|
|||
'dietcode_text': '3- RÉGIME SANS VIANDE',
|
||||
'bPhoto': True,
|
||||
'bLeaveAlone': False,
|
||||
'insurance': None,
|
||||
'insurance': {
|
||||
'company': 'Total Disaster Insurance',
|
||||
'contractEnd': '2022-12-31T00:00:00+01:00',
|
||||
'contractNumber': '123',
|
||||
'contractStart': '2022-01-01T00:00:00+01:00',
|
||||
'memberNumber': '456',
|
||||
},
|
||||
'subscribeSchoolList': [],
|
||||
'mother': {'num': 613963, 'civility': 'MME', 'firstname': 'JANE', 'lastname': 'DOE'},
|
||||
'father': {'num': 613878, 'civility': 'M.', 'firstname': 'JHON', 'lastname': 'DOE'},
|
||||
|
@ -1293,6 +1299,11 @@ def test_create_family(family_service, con, app):
|
|||
'childList/0/dietcode': 'RSV',
|
||||
'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
|
||||
'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
|
||||
'childList/0/insurance/company': 'Total Disaster Insurance',
|
||||
'childList/0/insurance/contractNumber': '123',
|
||||
'childList/0/insurance/memberNumber': '456',
|
||||
'childList/0/insurance/contractStart': '2022-01-01',
|
||||
'childList/0/insurance/contractEnd': '2022-12-31',
|
||||
}
|
||||
|
||||
resp = app.post_json(url + '?NameID=local', params=params)
|
||||
|
@ -1447,6 +1458,11 @@ def test_update_family(family_service, con, app):
|
|||
'childList/0/paiInfoBean/code': 'PAIALI',
|
||||
'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
|
||||
'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
|
||||
'childList/0/insurance/company': 'Armagedon Colapse',
|
||||
'childList/0/insurance/contractNumber': '444',
|
||||
'childList/0/insurance/memberNumber': '555',
|
||||
'childList/0/insurance/contractStart': '2022-01-02',
|
||||
'childList/0/insurance/contractEnd': '2022-12-31',
|
||||
'childList/1/num': '613880', # update child
|
||||
'childList/1/firstname': 'Brunelle',
|
||||
'childList/1/lastname': 'Doe',
|
||||
|
@ -1967,6 +1983,11 @@ def test_create_child(family_service, con, app):
|
|||
'sexe': 'F',
|
||||
'birth/dateBirth': '1943-01-19',
|
||||
'birth/place': 'Port Arthur',
|
||||
'insurance/company': 'Total Disaster Insurance',
|
||||
'insurance/contractNumber': '123',
|
||||
'insurance/memberNumber': '456',
|
||||
'insurance/contractStart': '2022-01-01',
|
||||
'insurance/contractEnd': '2022-12-31',
|
||||
}
|
||||
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
|
@ -2073,6 +2094,11 @@ def test_update_child(family_service, con, app):
|
|||
'birth/place': 'Port Arthur',
|
||||
'bPhoto': True,
|
||||
'bLeaveAlone': False,
|
||||
'insurance/company': 'Armagedon Colapse',
|
||||
'insurance/contractNumber': '444',
|
||||
'insurance/memberNumber': '555',
|
||||
'insurance/contractStart': '2022-01-02',
|
||||
'insurance/contractEnd': '2022-12-31',
|
||||
}
|
||||
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
|
|
Loading…
Reference in New Issue