0001-toulouse-maelis-return-family-id-on-read-family-memb.patch
functests/toulouse_maelis/conftest.py | ||
---|---|---|
293 | 293 |
def remove_id_on_rlg(rlg): |
294 | 294 |
if rlg: |
295 | 295 |
rlg['num'] = 'N/A' |
296 | 296 |
rlg['lastname'] = 'N/A' |
297 | 297 | |
298 | 298 | |
299 | 299 |
def remove_id_on_family(family): |
300 | 300 |
family['number'] = 'N/A' |
301 |
family['family_id'] = 'N/A' |
|
301 | 302 |
remove_id_on_rlg(family['RL1']) |
302 | 303 |
remove_id_on_rlg(family['RL2']) |
303 | 304 |
for child in family['childList']: |
304 | 305 |
remove_id_on_child(child) |
305 | 306 |
for person in family['emergencyPersonList']: |
306 | 307 |
person['numPerson'] = 'N/A' |
307 | 308 | |
308 | 309 |
functests/toulouse_maelis/data/test_create_family.json | ||
---|---|---|
238 | 238 |
"civility_text": "Madame", |
239 | 239 |
"quality_text": "ORGANISME SOCIAL", |
240 | 240 |
"sexe_text": "F\u00e9minin" |
241 | 241 |
} |
242 | 242 |
], |
243 | 243 |
"indicatorList": [], |
244 | 244 |
"childErrorList": [], |
245 | 245 |
"category_text": "BIPARENTALE", |
246 |
"situation_text": "Vivant maritalement" |
|
246 |
"situation_text": "Vivant maritalement", |
|
247 |
"family_id": "N/A" |
|
247 | 248 |
} |
functests/toulouse_maelis/data/test_update_family.json | ||
---|---|---|
339 | 339 |
"civility_text": "Madame", |
340 | 340 |
"quality_text": "ORGANISME SOCIAL", |
341 | 341 |
"sexe_text": "F\u00e9minin" |
342 | 342 |
} |
343 | 343 |
], |
344 | 344 |
"indicatorList": [], |
345 | 345 |
"childErrorList": [], |
346 | 346 |
"category_text": "BIPARENTALE", |
347 |
"situation_text": "Vivant maritalement" |
|
347 |
"situation_text": "Vivant maritalement", |
|
348 |
"family_id": "N/A" |
|
348 | 349 |
} |
functests/toulouse_maelis/data/test_update_family_ras.json | ||
---|---|---|
251 | 251 |
"contact": null, |
252 | 252 |
"quality_text": "AUTRE", |
253 | 253 |
"sexe_text": "Masculin" |
254 | 254 |
} |
255 | 255 |
], |
256 | 256 |
"indicatorList": [], |
257 | 257 |
"childErrorList": [], |
258 | 258 |
"category_text": "MONOPARENTALE", |
259 |
"situation_text": "UNION LIBRE" |
|
259 |
"situation_text": "UNION LIBRE", |
|
260 |
"family_id": "N/A" |
|
260 | 261 |
} |
passerelle/contrib/toulouse_maelis/models.py | ||
---|---|---|
732 | 732 |
parameters={ |
733 | 733 |
'NameID': {'description': 'Publik NameID'}, |
734 | 734 |
'income_year': {'description': 'Année de revenu pour filtrer les quotients'}, |
735 | 735 |
}, |
736 | 736 |
) |
737 | 737 |
def read_family(self, request, NameID, income_year=None): |
738 | 738 |
family_id = self.get_link(NameID).family_id |
739 | 739 |
data = self.get_family(family_id, incomeYear=income_year) |
740 |
data['family_id'] = family_id |
|
740 | 741 |
return {'data': data} |
741 | 742 | |
742 | 743 |
@endpoint( |
743 | 744 |
display_category='Famille', |
744 | 745 |
description="Informations sur un responsable légal", |
745 | 746 |
perm='can_access', |
746 | 747 |
name='read-rl', |
747 | 748 |
parameters={ |
748 | 749 |
'NameID': {'description': 'Publik NameID'}, |
749 | 750 |
'rl_id': {'description': 'Numéro du représentant légal'}, |
750 | 751 |
'income_year': {'description': 'Année de revenu pour filtrer les quotients'}, |
751 | 752 |
}, |
752 | 753 |
) |
753 | 754 |
def read_rl(self, request, NameID, rl_id, income_year=None): |
754 | 755 |
family_id = self.get_link(NameID).family_id |
755 | 756 |
data = self.get_rl(family_id, rl_id, incomeYear=income_year) |
757 |
data['family_id'] = family_id |
|
756 | 758 |
return {'data': data} |
757 | 759 | |
758 | 760 |
@endpoint( |
759 | 761 |
display_category='Famille', |
760 | 762 |
description="Informations sur une personne autorisée à récupérer les enfants ou à prévenir en cas d'urgence", |
761 | 763 |
perm='can_access', |
762 | 764 |
name='read-person', |
763 | 765 |
parameters={ |
764 | 766 |
'NameID': {'description': 'Publik NameID'}, |
765 | 767 |
'person_id': {'description': 'Numéro de la personne'}, |
766 | 768 |
}, |
767 | 769 |
) |
768 | 770 |
def read_person(self, request, NameID, person_id): |
769 | 771 |
family_id = self.get_link(NameID).family_id |
770 | 772 |
data = self.get_person(family_id, person_id) |
773 |
data['family_id'] = family_id |
|
771 | 774 |
return {'data': data} |
772 | 775 | |
773 | 776 |
@endpoint( |
774 | 777 |
display_category='Famille', |
775 | 778 |
description="Informations sur un enfant", |
776 | 779 |
perm='can_access', |
777 | 780 |
name='read-child', |
778 | 781 |
parameters={ |
779 | 782 |
'NameID': {'description': 'Publik NameID'}, |
780 | 783 |
'child_id': {'description': "Numéro de l'enfant"}, |
781 | 784 |
}, |
782 | 785 |
) |
783 | 786 |
def read_child(self, request, NameID, child_id): |
784 | 787 |
family_id = self.get_link(NameID).family_id |
785 | 788 |
data = self.get_child(family_id, child_id) |
789 |
data['family_id'] = family_id |
|
786 | 790 |
return {'data': data} |
787 | 791 | |
788 | 792 |
@endpoint( |
789 | 793 |
display_category='Famille', |
790 | 794 |
description="Informations sur une personne autorisée à récupérer l'enfant", |
791 | 795 |
perm='can_access', |
792 | 796 |
name='read-child-person', |
793 | 797 |
parameters={ |
794 | 798 |
'NameID': {'description': 'Publik NameID'}, |
795 | 799 |
'child_id': {'description': "Numéro de l'enfant"}, |
796 | 800 |
'person_id': {'description': 'Numéro de la personne'}, |
797 | 801 |
}, |
798 | 802 |
) |
799 | 803 |
def read_child_person(self, request, NameID, child_id, person_id): |
800 | 804 |
family_id = self.get_link(NameID).family_id |
801 | 805 |
data = self.get_child_person(family_id, child_id, person_id) |
806 |
data['family_id'] = family_id |
|
802 | 807 |
return {'data': data} |
803 | 808 | |
804 | 809 |
@endpoint( |
805 | 810 |
display_category='Famille', |
806 | 811 |
description="Vérifier qu'un responsable légal existe en base", |
807 | 812 |
perm='can_access', |
808 | 813 |
name='is-rl-exists', |
809 | 814 |
post={'request_body': {'schema': {'application/json': schemas.ISEXISTS_SCHEMA}}}, |
tests/test_toulouse_maelis.py | ||
---|---|---|
677 | 677 |
resp = app.get(url + '?NameID=local') |
678 | 678 |
assert resp.json['err'] == 0 |
679 | 679 |
data = resp.json['data'] |
680 | 680 |
del data['RL1'] |
681 | 681 |
del data['RL2'] |
682 | 682 |
del data['childList'] |
683 | 683 |
del data['emergencyPersonList'] |
684 | 684 |
assert data == { |
685 |
'family_id': '1312', |
|
685 | 686 |
'number': 1312, |
686 | 687 |
'category': 'BI', |
687 | 688 |
'situation': 'M', |
688 | 689 |
'flagCom': True, |
689 | 690 |
'nbChild': 2, |
690 | 691 |
'nbTotalChild': None, |
691 | 692 |
'nbAES': None, |
692 | 693 |
'quotientList': [], |
... | ... | |
927 | 928 |
def test_read_rl2(family_service, con, app): |
928 | 929 |
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml')) |
929 | 930 |
url = get_endpoint('read-rl') |
930 | 931 |
Link.objects.create(resource=con, family_id='1312', name_id='local') |
931 | 932 | |
932 | 933 |
resp = app.get(url + '?NameID=local&rl_id=613879') |
933 | 934 |
assert resp.json['err'] == 0 |
934 | 935 |
assert resp.json['data'] == { |
936 |
'family_id': '1312', |
|
935 | 937 |
'num': '613879', |
936 | 938 |
'lastname': 'DOE', |
937 | 939 |
'firstname': 'JANE', |
938 | 940 |
'maidenName': 'SMITH', |
939 | 941 |
'quality': 'MERE', |
940 | 942 |
'civility': 'MME', |
941 | 943 |
'birth': { |
942 | 944 |
'communeCode': None, |
943 |
- |