0002-toulouse-maelis-rename-category-field-71641.patch
passerelle/contrib/toulouse_maelis/models.py | ||
---|---|---|
314 | 314 | |
315 | 315 |
def assert_rl_payload_in_referential(self, post_data, parent_keys=None): |
316 | 316 |
keys = parent_keys or [] |
317 | 317 |
self.assert_post_data_in_referential('Civility', post_data, keys + ['civility']) |
318 | 318 |
self.assert_post_data_in_referential('Quality', post_data, keys + ['quality']) |
319 | 319 |
self.assert_update_coordinate_payload_in_referential(post_data, keys) |
320 | 320 | |
321 | 321 |
def assert_create_rl1_payload_in_referential(self, post_data): |
322 |
self.assert_post_data_in_referential('Category', post_data, ['categorie'])
|
|
322 |
self.assert_post_data_in_referential('Category', post_data, ['category'])
|
|
323 | 323 |
self.assert_post_data_in_referential('Situation', post_data, ['situation']) |
324 | 324 |
self.assert_rl_payload_in_referential(post_data, ['rl1']) |
325 | 325 | |
326 | 326 |
def assert_family_payload_in_referential(self, post_data): |
327 |
self.assert_post_data_in_referential('Category', post_data, ['categorie'])
|
|
327 |
self.assert_post_data_in_referential('Category', post_data, ['category'])
|
|
328 | 328 |
self.assert_post_data_in_referential('Situation', post_data, ['situation']) |
329 | 329 |
for rlg in 'rl1', 'rl2': |
330 | 330 |
if rlg in post_data: |
331 | 331 |
self.assert_rl_payload_in_referential(post_data, [rlg]) |
332 | 332 |
for i, person in enumerate(post_data.get('emergencyPersonList') or []): |
333 | 333 |
for j in range(0, len(person.get('personList') or [])): |
334 | 334 |
self.assert_person_payload_in_referential( |
335 | 335 |
post_data, ['emergencyPersonList', i, 'personList', j] |
... | ... | |
674 | 674 |
self.assert_rl_payload_in_referential(post_data) |
675 | 675 |
self.replace_null_values(post_data) |
676 | 676 | |
677 | 677 |
rl1 = post_data |
678 | 678 |
rl1['num'] = family['RL1']['num'] |
679 | 679 |
rl1['adresse'] = family['RL1']['adresse'] |
680 | 680 |
payload = { |
681 | 681 |
'dossierNumber': family_id, |
682 |
'categorie': family['category'],
|
|
682 |
'category': family['category'],
|
|
683 | 683 |
'situation': family['situation'], |
684 | 684 |
'flagCom': family['flagCom'], |
685 | 685 |
'nbChild': family['nbChild'], |
686 | 686 |
'nbTotalChild': family['nbTotalChild'], |
687 | 687 |
'nbAES': family['nbAES'], |
688 | 688 |
'rl1': rl1, |
689 | 689 |
} |
690 | 690 |
self.call('Family', 'updateFamily', **payload) |
... | ... | |
702 | 702 |
family_id = self.get_link(NameID).family_id |
703 | 703 |
family = self.get_family_raw(family_id) |
704 | 704 |
if family['RL2']: |
705 | 705 |
raise APIError('RL2 already defined on family', err_code='already-rl2') |
706 | 706 |
self.assert_rl_payload_in_referential(post_data) |
707 | 707 | |
708 | 708 |
payload = { |
709 | 709 |
'dossierNumber': family_id, |
710 |
'categorie': family['category'],
|
|
710 |
'category': family['category'],
|
|
711 | 711 |
'situation': family['situation'], |
712 | 712 |
'flagCom': family['flagCom'], |
713 | 713 |
'nbChild': family['nbChild'], |
714 | 714 |
'nbTotalChild': family['nbTotalChild'], |
715 | 715 |
'nbAES': family['nbAES'], |
716 | 716 |
'rl2': post_data, |
717 | 717 |
} |
718 | 718 |
response = self.call('Family', 'updateFamily', **payload) |
... | ... | |
734 | 734 |
self.assert_rl_payload_in_referential(post_data) |
735 | 735 |
self.replace_null_values(post_data) |
736 | 736 | |
737 | 737 |
rl2 = post_data |
738 | 738 |
rl2['num'] = family['RL2']['num'] |
739 | 739 |
rl2['adresse'] = family['RL2']['adresse'] |
740 | 740 |
payload = { |
741 | 741 |
'dossierNumber': family_id, |
742 |
'categorie': family['category'],
|
|
742 |
'category': family['category'],
|
|
743 | 743 |
'situation': family['situation'], |
744 | 744 |
'flagCom': family['flagCom'], |
745 | 745 |
'nbChild': family['nbChild'], |
746 | 746 |
'nbTotalChild': family['nbTotalChild'], |
747 | 747 |
'nbAES': family['nbAES'], |
748 | 748 |
'rl2': rl2, |
749 | 749 |
} |
750 | 750 |
self.call('Family', 'updateFamily', **payload) |
... | ... | |
800 | 800 |
raise APIError('No child %s to update on family' % child_id, err_code='no-child') |
801 | 801 |
self.assert_child_payload_in_referential(post_data) |
802 | 802 |
self.replace_null_values(post_data) |
803 | 803 | |
804 | 804 |
child = post_data |
805 | 805 |
child['num'] = child_id |
806 | 806 |
payload = { |
807 | 807 |
'dossierNumber': family_id, |
808 |
'categorie': family['category'],
|
|
808 |
'category': family['category'],
|
|
809 | 809 |
'situation': family['situation'], |
810 | 810 |
'flagCom': family['flagCom'], |
811 | 811 |
'nbChild': family['nbChild'], |
812 | 812 |
'nbTotalChild': family['nbTotalChild'], |
813 | 813 |
'nbAES': family['nbAES'], |
814 | 814 |
'childList': [child], |
815 | 815 |
} |
816 | 816 |
self.call('Family', 'updateFamily', **payload) |
... | ... | |
849 | 849 |
family_id = self.get_link(NameID).family_id |
850 | 850 |
family = self.get_family_raw(family_id) |
851 | 851 |
self.assert_person_payload_in_referential(post_data) |
852 | 852 | |
853 | 853 |
personList = family['emergencyPersonList'] |
854 | 854 |
personList.append(post_data) |
855 | 855 |
payload = { |
856 | 856 |
'dossierNumber': family_id, |
857 |
'categorie': family['category'],
|
|
857 |
'category': family['category'],
|
|
858 | 858 |
'situation': family['situation'], |
859 | 859 |
'flagCom': family['flagCom'], |
860 | 860 |
'nbChild': family['nbChild'], |
861 | 861 |
'nbTotalChild': family['nbTotalChild'], |
862 | 862 |
'nbAES': family['nbAES'], |
863 | 863 |
'emergencyPersonList': [{'personList': personList}], |
864 | 864 |
} |
865 | 865 |
self.call('Family', 'updateFamily', **payload) |
... | ... | |
888 | 888 |
personList[i]['numPerson'] = person_id |
889 | 889 |
break |
890 | 890 |
else: |
891 | 891 |
raise APIError( |
892 | 892 |
"no '%s' authorized person on '%s' family" % (person_id, family_id), err_code='not-found' |
893 | 893 |
) |
894 | 894 |
payload = { |
895 | 895 |
'dossierNumber': family_id, |
896 |
'categorie': family['category'],
|
|
896 |
'category': family['category'],
|
|
897 | 897 |
'situation': family['situation'], |
898 | 898 |
'flagCom': family['flagCom'], |
899 | 899 |
'nbChild': family['nbChild'], |
900 | 900 |
'nbTotalChild': family['nbTotalChild'], |
901 | 901 |
'nbAES': family['nbAES'], |
902 | 902 |
'emergencyPersonList': [{'personList': personList}], |
903 | 903 |
} |
904 | 904 |
self.call('Family', 'updateFamily', **payload) |
... | ... | |
925 | 925 |
del personList[i] |
926 | 926 |
break |
927 | 927 |
else: |
928 | 928 |
raise APIError( |
929 | 929 |
"no '%s' authorized person on '%s' family" % (person_id, family_id), err_code='not-found' |
930 | 930 |
) |
931 | 931 |
payload = { |
932 | 932 |
'dossierNumber': family_id, |
933 |
'categorie': family['category'],
|
|
933 |
'category': family['category'],
|
|
934 | 934 |
'situation': family['situation'], |
935 | 935 |
'flagCom': family['flagCom'], |
936 | 936 |
'nbChild': family['nbChild'], |
937 | 937 |
'nbTotalChild': family['nbTotalChild'], |
938 | 938 |
'nbAES': family['nbAES'], |
939 | 939 |
'emergencyPersonList': [{'personList': personList}], |
940 | 940 |
} |
941 | 941 |
self.call('Family', 'updateFamily', **payload) |
passerelle/contrib/toulouse_maelis/schemas.py | ||
---|---|---|
465 | 465 |
}, |
466 | 466 |
} |
467 | 467 | |
468 | 468 |
UPDATE_FAMILY_SCHEMA = { |
469 | 469 |
'$schema': 'http://json-schema.org/draft-04/schema#', |
470 | 470 |
'title': 'Family', |
471 | 471 |
'description': 'Informations pour créer ou mettre à jour une famille', |
472 | 472 |
'type': 'object', |
473 |
'required': ['categorie', 'situation'],
|
|
473 |
'required': ['category', 'situation'],
|
|
474 | 474 |
'properties': { |
475 |
'categorie': {
|
|
476 |
'description': 'Categorie (depuis référentiel)',
|
|
475 |
'category': {
|
|
476 |
'description': 'Catégorie (depuis référentiel)',
|
|
477 | 477 |
'type': 'string', |
478 | 478 |
'pattern': '.+', |
479 | 479 |
}, |
480 | 480 |
'situation': { |
481 | 481 |
'description': 'Situation familiale (depuis référentiel)', |
482 | 482 |
'type': 'string', |
483 | 483 |
'pattern': '.+', |
484 | 484 |
}, |
... | ... | |
519 | 519 |
], |
520 | 520 |
}, |
521 | 521 |
}, |
522 | 522 |
'unflatten': True, |
523 | 523 |
'additionalProperties': False, |
524 | 524 |
} |
525 | 525 | |
526 | 526 |
CREATE_FAMILY_SCHEMA = copy.deepcopy(UPDATE_FAMILY_SCHEMA) |
527 |
CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'categorie', 'situation']
|
|
527 |
CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'category', 'situation']
|
|
528 | 528 |
create_family_child_schema = CREATE_FAMILY_SCHEMA['properties']['childList']['oneOf'][0]['items'] |
529 | 529 |
del create_family_child_schema['properties']['bPhoto'] |
530 | 530 |
del create_family_child_schema['properties']['bLeaveAlone'] |
531 | 531 |
del create_family_child_schema['properties']['paiInfoBean'] |
532 | 532 | |
533 | 533 |
CREATE_RL1_SCHEMA = copy.deepcopy(CREATE_FAMILY_SCHEMA) |
534 | 534 |
del CREATE_RL1_SCHEMA['properties']['rl2'] |
535 | 535 |
del CREATE_RL1_SCHEMA['properties']['emergencyPersonList'] |
tests/data/toulouse_maelis/Q_create_family.xml | ||
---|---|---|
5 | 5 |
<wsse:UsernameToken> |
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 |
<categorie>ACCEUI</categorie>
|
|
13 |
<category>ACCEUI</category>
|
|
14 | 14 |
<situation>C</situation> |
15 | 15 |
<rl1> |
16 | 16 |
<lastname>Doe</lastname> |
17 | 17 |
<firstname>Jhon</firstname> |
18 | 18 |
<quality>AU</quality> |
19 | 19 |
<civility>M.</civility> |
20 | 20 |
<dateBirth>1938-07-26</dateBirth> |
21 | 21 |
<adresse> |
... | ... | |
27 | 27 |
<profession> |
28 | 28 |
<codeCSP>ART</codeCSP> |
29 | 29 |
</profession> |
30 | 30 |
<CAFInfo> |
31 | 31 |
<organ>A10007752822</organ> |
32 | 32 |
</CAFInfo> |
33 | 33 |
</rl1> |
34 | 34 |
<childList> |
35 |
<sexe>M</sexe> |
|
36 |
<lastname>Zimmerman</lastname> |
|
37 | 35 |
<firstname>Robert</firstname> |
36 |
<lastname>Zimmerman</lastname> |
|
37 |
<sexe>M</sexe> |
|
38 | 38 |
<dateBirth>1941-05-24</dateBirth> |
39 | 39 |
<dietcode>RSV</dietcode> |
40 | 40 |
<medicalRecord> |
41 | 41 |
<vaccinList> |
42 | 42 |
<code>DTC</code> |
43 | 43 |
</vaccinList> |
44 | 44 |
</medicalRecord> |
45 | 45 |
</childList> |
tests/data/toulouse_maelis/Q_create_person.xml | ||
---|---|---|
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 | 13 |
<dossierNumber>1312</dossierNumber> |
14 |
<categorie>BI</categorie>
|
|
14 |
<category>BI</category>
|
|
15 | 15 |
<situation>M</situation> |
16 | 16 |
<flagCom>true</flagCom> |
17 | 17 |
<nbChild>2</nbChild> |
18 | 18 |
<emergencyPersonList> |
19 | 19 |
<personList> |
20 | 20 |
<numPerson>614059</numPerson> |
21 | 21 |
<civility>MME</civility> |
22 | 22 |
<firstname>KENY</firstname> |
tests/data/toulouse_maelis/Q_create_rl1.xml | ||
---|---|---|
5 | 5 |
<wsse:UsernameToken> |
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 |
<categorie>ACCEUI</categorie>
|
|
13 |
<category>ACCEUI</category>
|
|
14 | 14 |
<situation>C</situation> |
15 | 15 |
<rl1> |
16 | 16 |
<lastname>Doe</lastname> |
17 | 17 |
<firstname>Jhon</firstname> |
18 | 18 |
<quality>AU</quality> |
19 | 19 |
<civility>M.</civility> |
20 | 20 |
<dateBirth>1938-07-26</dateBirth> |
21 | 21 |
<adresse> |
tests/data/toulouse_maelis/Q_create_rl2.xml | ||
---|---|---|
5 | 5 |
<wsse:Username>maelis-webservice</wsse:Username> |
6 | 6 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
7 | 7 |
</wsse:UsernameToken> |
8 | 8 |
</wsse:Security> |
9 | 9 |
</soap-env:Header> |
10 | 10 |
<soap-env:Body> |
11 | 11 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
12 | 12 |
<dossierNumber>1312</dossierNumber> |
13 |
<categorie>BI</categorie>
|
|
13 |
<category>BI</category>
|
|
14 | 14 |
<situation>M</situation> |
15 | 15 |
<flagCom>true</flagCom> |
16 | 16 |
<nbChild>2</nbChild> |
17 | 17 |
<rl2> |
18 | 18 |
<lastname>DOE</lastname> |
19 | 19 |
<firstname>JANE</firstname> |
20 | 20 |
<quality>MERE</quality> |
21 | 21 |
<civility>MME</civility> |
tests/data/toulouse_maelis/Q_delete_person.xml | ||
---|---|---|
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 | 13 |
<dossierNumber>1312</dossierNumber> |
14 |
<categorie>BI</categorie>
|
|
14 |
<category>BI</category>
|
|
15 | 15 |
<situation>M</situation> |
16 | 16 |
<flagCom>true</flagCom> |
17 | 17 |
<nbChild>2</nbChild> |
18 | 18 |
<emergencyPersonList/> |
19 | 19 |
</ns0:updateFamily> |
20 | 20 |
</soap-env:Body> |
21 | 21 |
</soap-env:Envelope> |
tests/data/toulouse_maelis/Q_update_child.xml | ||
---|---|---|
5 | 5 |
<wsse:Username>maelis-webservice</wsse:Username> |
6 | 6 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
7 | 7 |
</wsse:UsernameToken> |
8 | 8 |
</wsse:Security> |
9 | 9 |
</soap-env:Header> |
10 | 10 |
<soap-env:Body> |
11 | 11 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
12 | 12 |
<dossierNumber>1312</dossierNumber> |
13 |
<categorie>BI</categorie>
|
|
13 |
<category>BI</category>
|
|
14 | 14 |
<situation>M</situation> |
15 | 15 |
<flagCom>true</flagCom> |
16 | 16 |
<nbChild>2</nbChild> |
17 | 17 |
<childList> |
18 | 18 |
<num>613880</num> |
19 | 19 |
<lastname>DOE</lastname> |
20 | 20 |
<firstname>JANNIS</firstname> |
21 | 21 |
<sexe>F</sexe> |
tests/data/toulouse_maelis/Q_update_family.xml | ||
---|---|---|
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 | 13 |
<dossierNumber>1312</dossierNumber> |
14 |
<categorie>BI</categorie>
|
|
14 |
<category>BI</category>
|
|
15 | 15 |
<situation>C</situation> |
16 | 16 |
<rl1> |
17 | 17 |
<lastname>Doe</lastname> |
18 | 18 |
<firstname>Jhon</firstname> |
19 | 19 |
<quality>AU</quality> |
20 | 20 |
<civility>M.</civility> |
21 | 21 |
<dateBirth>1938-07-26</dateBirth> |
22 | 22 |
<adresse> |
tests/data/toulouse_maelis/Q_update_person.xml | ||
---|---|---|
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 | 13 |
<dossierNumber>1312</dossierNumber> |
14 |
<categorie>BI</categorie>
|
|
14 |
<category>BI</category>
|
|
15 | 15 |
<situation>M</situation> |
16 | 16 |
<flagCom>true</flagCom> |
17 | 17 |
<nbChild>2</nbChild> |
18 | 18 |
<emergencyPersonList> |
19 | 19 |
<personList> |
20 | 20 |
<numPerson>614059</numPerson> |
21 | 21 |
<firstname>Mathias</firstname> |
22 | 22 |
<lastname>Cassel</lastname> |
tests/data/toulouse_maelis/Q_update_rl1.xml | ||
---|---|---|
6 | 6 |
<wsse:Username>maelis-webservice</wsse:Username> |
7 | 7 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
8 | 8 |
</wsse:UsernameToken> |
9 | 9 |
</wsse:Security> |
10 | 10 |
</soap-env:Header> |
11 | 11 |
<soap-env:Body> |
12 | 12 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
13 | 13 |
<dossierNumber>1312</dossierNumber> |
14 |
<categorie>BI</categorie>
|
|
14 |
<category>BI</category>
|
|
15 | 15 |
<situation>M</situation> |
16 | 16 |
<flagCom>true</flagCom> |
17 | 17 |
<nbChild>2</nbChild> |
18 | 18 |
<rl1> |
19 | 19 |
<num>613878</num> |
20 | 20 |
<lastname>Doe</lastname> |
21 | 21 |
<firstname>Jhonny</firstname> |
22 | 22 |
<quality>PERE</quality> |
tests/data/toulouse_maelis/Q_update_rl2.xml | ||
---|---|---|
5 | 5 |
<wsse:Username>maelis-webservice</wsse:Username> |
6 | 6 |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password> |
7 | 7 |
</wsse:UsernameToken> |
8 | 8 |
</wsse:Security> |
9 | 9 |
</soap-env:Header> |
10 | 10 |
<soap-env:Body> |
11 | 11 |
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com"> |
12 | 12 |
<dossierNumber>1312</dossierNumber> |
13 |
<categorie>BI</categorie>
|
|
13 |
<category>BI</category>
|
|
14 | 14 |
<situation>M</situation> |
15 | 15 |
<flagCom>true</flagCom> |
16 | 16 |
<nbChild>2</nbChild> |
17 | 17 |
<rl2> |
18 | 18 |
<num>613879</num> |
19 | 19 |
<lastname>DOE</lastname> |
20 | 20 |
<firstname>JANE</firstname> |
21 | 21 |
<quality>MERE</quality> |
tests/test_toulouse_maelis.py | ||
---|---|---|
1022 | 1022 |
READ_CSP, |
1023 | 1023 |
READ_ORGAN, |
1024 | 1024 |
READ_DIETCODE, |
1025 | 1025 |
READ_VACCIN, |
1026 | 1026 |
CREATE_FAMILY, |
1027 | 1027 |
] |
1028 | 1028 |
url = get_endpoint('create-family') |
1029 | 1029 |
params = { |
1030 |
'categorie': 'ACCEUI',
|
|
1030 |
'category': 'ACCEUI',
|
|
1031 | 1031 |
'situation': 'C', |
1032 | 1032 |
'rl1/civility': 'M.', |
1033 | 1033 |
'rl1/firstname': 'Jhon', |
1034 | 1034 |
'rl1/lastname': 'Doe', |
1035 | 1035 |
'rl1/quality': 'AU', |
1036 | 1036 |
'rl1/dateBirth': '1938-07-26', |
1037 | 1037 |
'rl1/adresse/street1': 'Chateau', |
1038 | 1038 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1058 | 1058 |
'childErrorList': [], |
1059 | 1059 |
} |
1060 | 1060 |
assert Link.objects.get(resource=con, family_id='196545', name_id='local') |
1061 | 1061 | |
1062 | 1062 | |
1063 | 1063 |
def test_create_family_empty_referential_key_error(con, app): |
1064 | 1064 |
url = get_endpoint('create-family') |
1065 | 1065 |
params = { |
1066 |
'categorie': '',
|
|
1067 |
'situation': '', |
|
1066 |
'category': '',
|
|
1067 |
'situation': 'C',
|
|
1068 | 1068 |
'rl1/civility': 'M.', |
1069 | 1069 |
'rl1/firstname': 'Jhon', |
1070 | 1070 |
'rl1/lastname': 'Doe', |
1071 | 1071 |
'rl1/quality': 'AU', |
1072 | 1072 |
'rl1/dateBirth': '1938-07-26', |
1073 | 1073 |
'rl1/adresse/street1': 'Chateau', |
1074 | 1074 |
'rl1/adresse/town': 'Paris', |
1075 | 1075 |
'rl1/adresse/zipcode': '75014', |
1076 | 1076 |
} |
1077 | 1077 | |
1078 | 1078 |
resp = app.post_json(url + '?NameID=local', params=params, status=400) |
1079 | 1079 |
assert resp.json['err'] == 1 |
1080 |
assert resp.json['err_desc'] == "categorie: '' does not match '.+'"
|
|
1080 |
assert resp.json['err_desc'] == "category: '' does not match '.+'"
|
|
1081 | 1081 | |
1082 | 1082 | |
1083 | 1083 |
def test_create_family_already_linked_error(con, app): |
1084 | 1084 |
url = get_endpoint('create-family') |
1085 | 1085 |
params = { |
1086 |
'categorie': 'ACCEUI',
|
|
1086 |
'category': 'ACCEUI',
|
|
1087 | 1087 |
'situation': 'C', |
1088 | 1088 |
'rl1/civility': 'M.', |
1089 | 1089 |
'rl1/firstname': 'Jhon', |
1090 | 1090 |
'rl1/lastname': 'Doe', |
1091 | 1091 |
'rl1/quality': 'AU', |
1092 | 1092 |
'rl1/dateBirth': '1938-07-26', |
1093 | 1093 |
'rl1/adresse/street1': 'Chateau', |
1094 | 1094 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1109 | 1109 |
READ_CATEGORIES, |
1110 | 1110 |
READ_SITUATIONS, |
1111 | 1111 |
READ_CIVILITIES, |
1112 | 1112 |
READ_QUALITIES, |
1113 | 1113 |
CREATE_FAMILY_ERR, |
1114 | 1114 |
] |
1115 | 1115 |
url = get_endpoint('create-family') |
1116 | 1116 |
params = { |
1117 |
'categorie': 'ACCEUI',
|
|
1117 |
'category': 'ACCEUI',
|
|
1118 | 1118 |
'situation': 'C', |
1119 | 1119 |
'rl1/civility': 'M.', |
1120 | 1120 |
'rl1/firstname': 'Jhon', |
1121 | 1121 |
'rl1/lastname': 'Doe', |
1122 | 1122 |
'rl1/quality': 'AU', |
1123 | 1123 |
'rl1/dateBirth': '1938-07-26', |
1124 | 1124 |
'rl1/adresse/street1': 'Chateau', |
1125 | 1125 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1142 | 1142 |
READ_QUALITIES, |
1143 | 1143 |
READ_CSP, |
1144 | 1144 |
READ_ORGAN, |
1145 | 1145 |
READ_DIETCODE, |
1146 | 1146 |
READ_VACCIN, |
1147 | 1147 |
] |
1148 | 1148 |
url = get_endpoint('create-family') |
1149 | 1149 |
params = { |
1150 |
'categorie': 'ACCEUI',
|
|
1150 |
'category': 'ACCEUI',
|
|
1151 | 1151 |
'situation': 'C', |
1152 | 1152 |
'rl1/civility': 'M.', |
1153 | 1153 |
'rl1/firstname': 'Jhon', |
1154 | 1154 |
'rl1/lastname': 'Doe', |
1155 | 1155 |
'rl1/quality': 'AU', |
1156 | 1156 |
'rl1/dateBirth': '1938-07-26', |
1157 | 1157 |
'rl1/adresse/street1': 'Chateau', |
1158 | 1158 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1189 | 1189 |
READ_ORGAN, |
1190 | 1190 |
READ_DIETCODE, |
1191 | 1191 |
READ_PAI, |
1192 | 1192 |
READ_VACCIN, |
1193 | 1193 |
UPDATE_FAMILY, |
1194 | 1194 |
] |
1195 | 1195 |
url = get_endpoint('update-family') |
1196 | 1196 |
params = { |
1197 |
'categorie': 'BI',
|
|
1197 |
'category': 'BI',
|
|
1198 | 1198 |
'situation': 'C', |
1199 | 1199 |
'rl1/civility': 'M.', |
1200 | 1200 |
'rl1/firstname': 'Jhon', |
1201 | 1201 |
'rl1/lastname': 'Doe', |
1202 | 1202 |
'rl1/quality': 'AU', |
1203 | 1203 |
'rl1/dateBirth': '1938-07-26', |
1204 | 1204 |
'rl1/adresse/street1': 'Chateau', |
1205 | 1205 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1229 | 1229 |
assert resp.json['err'] == 0 |
1230 | 1230 |
assert resp.json['data']['number'] == 196544 |
1231 | 1231 |
assert not resp.json['data']['childErrorList'] |
1232 | 1232 | |
1233 | 1233 | |
1234 | 1234 |
def test_update_family_not_linked_error(con, app): |
1235 | 1235 |
url = get_endpoint('update-family') |
1236 | 1236 |
params = { |
1237 |
'categorie': 'BI',
|
|
1237 |
'category': 'BI',
|
|
1238 | 1238 |
'situation': 'C', |
1239 | 1239 |
'rl1/civility': 'M.', |
1240 | 1240 |
'rl1/firstname': 'Jhon', |
1241 | 1241 |
'rl1/lastname': 'Doe', |
1242 | 1242 |
'rl1/quality': 'AU', |
1243 | 1243 |
'rl1/dateBirth': '1938-07-26', |
1244 | 1244 |
'rl1/adresse/street1': 'Chateau', |
1245 | 1245 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1257 | 1257 |
mocked_get.return_value = FAMILY_SERVICE_WSDL |
1258 | 1258 |
mocked_post.side_effect = [ |
1259 | 1259 |
READ_CATEGORIES, |
1260 | 1260 |
READ_SITUATIONS, |
1261 | 1261 |
UPDATE_FAMILY_ERR, |
1262 | 1262 |
] |
1263 | 1263 |
url = get_endpoint('update-family') |
1264 | 1264 |
params = { |
1265 |
'categorie': 'ACCEUI',
|
|
1265 |
'category': 'ACCEUI',
|
|
1266 | 1266 |
'situation': 'C', |
1267 | 1267 |
'childList/0/lastname': 'Zimmerman', |
1268 | 1268 |
'childList/0/firstname': 'Robert', |
1269 | 1269 |
'childList/0/sexe': 'M', |
1270 | 1270 |
'childList/0/birth/dateBirth': '1941-05-24', |
1271 | 1271 |
'childList/0/birth/place': 'Duluth', |
1272 | 1272 |
} |
1273 | 1273 | |
... | ... | |
1280 | 1280 |
@mock.patch('passerelle.utils.Request.get') |
1281 | 1281 |
@mock.patch('passerelle.utils.Request.post') |
1282 | 1282 |
def test_update_family_soap_error(mocked_post, mocked_get, con, app): |
1283 | 1283 |
mocked_get.return_value = FAMILY_SERVICE_WSDL |
1284 | 1284 |
mocked_post.return_value = UPDATE_FAMILY_500 |
1285 | 1285 |
url = get_endpoint('update-family') |
1286 | 1286 |
params = { |
1287 | 1287 |
'nbChild': '100', |
1288 |
'categorie': 'BI',
|
|
1288 |
'category': 'BI',
|
|
1289 | 1289 |
'situation': 'C', |
1290 | 1290 |
'rl1/civility': 'M.', |
1291 | 1291 |
'rl1/firstname': 'Jhon', |
1292 | 1292 |
'rl1/lastname': 'Doe', |
1293 | 1293 |
'rl1/quality': 'AU', |
1294 | 1294 |
'rl1/dateBirth': '1938-07-26', |
1295 | 1295 |
'rl1/adresse/street1': 'Chateau', |
1296 | 1296 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1315 | 1315 |
READ_CSP, |
1316 | 1316 |
READ_ORGAN, |
1317 | 1317 |
READ_DIETCODE, |
1318 | 1318 |
READ_PAI, |
1319 | 1319 |
READ_VACCIN, |
1320 | 1320 |
] |
1321 | 1321 |
url = get_endpoint('update-family') |
1322 | 1322 |
params = { |
1323 |
'categorie': 'BI',
|
|
1323 |
'category': 'BI',
|
|
1324 | 1324 |
'situation': 'C', |
1325 | 1325 |
'rl1/civility': 'M.', |
1326 | 1326 |
'rl1/firstname': 'Jhon', |
1327 | 1327 |
'rl1/lastname': 'Doe', |
1328 | 1328 |
'rl1/quality': 'AU', |
1329 | 1329 |
'rl1/dateBirth': '1938-07-26', |
1330 | 1330 |
'rl1/adresse/street1': 'Chateau', |
1331 | 1331 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1366 | 1366 |
READ_CATEGORIES, |
1367 | 1367 |
READ_SITUATIONS, |
1368 | 1368 |
READ_CIVILITIES, |
1369 | 1369 |
READ_QUALITIES, |
1370 | 1370 |
CREATE_FAMILY, |
1371 | 1371 |
] |
1372 | 1372 |
url = get_endpoint('create-rl1') |
1373 | 1373 |
params = { |
1374 |
'categorie': 'ACCEUI',
|
|
1374 |
'category': 'ACCEUI',
|
|
1375 | 1375 |
'situation': 'C', |
1376 | 1376 |
'rl1/civility': 'M.', |
1377 | 1377 |
'rl1/firstname': 'Jhon', |
1378 | 1378 |
'rl1/lastname': 'Doe', |
1379 | 1379 |
'rl1/quality': 'AU', |
1380 | 1380 |
'rl1/dateBirth': '1938-07-26', |
1381 | 1381 |
'rl1/adresse/street1': 'Chateau', |
1382 | 1382 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1388 | 1388 |
assert resp.json['err'] == 0 |
1389 | 1389 |
assert resp.json['data'] == {'family_id': 196545} |
1390 | 1390 |
assert Link.objects.get(resource=con, family_id='196545', name_id='local') |
1391 | 1391 | |
1392 | 1392 | |
1393 | 1393 |
def test_create_rl1_empty_referential_key_error(con, app): |
1394 | 1394 |
url = get_endpoint('create-rl1') |
1395 | 1395 |
params = { |
1396 |
'categorie': 'ACCEUI',
|
|
1396 |
'category': 'ACCEUI',
|
|
1397 | 1397 |
'situation': 'C', |
1398 | 1398 |
'rl1/civility': '', |
1399 | 1399 |
'rl1/firstname': 'Jhon', |
1400 | 1400 |
'rl1/lastname': 'Doe', |
1401 | 1401 |
'rl1/quality': '', |
1402 | 1402 |
'rl1/dateBirth': '1938-07-26', |
1403 | 1403 |
'rl1/adresse/street1': 'Chateau', |
1404 | 1404 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1408 | 1408 |
resp = app.post_json(url + '?NameID=local', params=params, status=400) |
1409 | 1409 |
assert resp.json['err'] == 1 |
1410 | 1410 |
assert resp.json['err_desc'] == "rl1/civility: '' does not match '.+'" |
1411 | 1411 | |
1412 | 1412 | |
1413 | 1413 |
def test_create_rl1_already_linked_error(con, app): |
1414 | 1414 |
url = get_endpoint('create-rl1') |
1415 | 1415 |
params = { |
1416 |
'categorie': 'ACCEUI',
|
|
1416 |
'category': 'ACCEUI',
|
|
1417 | 1417 |
'situation': 'C', |
1418 | 1418 |
'rl1/civility': 'M.', |
1419 | 1419 |
'rl1/firstname': 'Jhon', |
1420 | 1420 |
'rl1/lastname': 'Doe', |
1421 | 1421 |
'rl1/quality': 'AU', |
1422 | 1422 |
'rl1/dateBirth': '1938-07-26', |
1423 | 1423 |
'rl1/adresse/street1': 'Chateau', |
1424 | 1424 |
'rl1/adresse/town': 'Paris', |
... | ... | |
1433 | 1433 | |
1434 | 1434 |
@mock.patch('passerelle.utils.Request.get') |
1435 | 1435 |
@mock.patch('passerelle.utils.Request.post') |
1436 | 1436 |
def test_create_rl1_wrong_referential_key_error(mocked_post, mocked_get, con, app): |
1437 | 1437 |
mocked_get.return_value = FAMILY_SERVICE_WSDL |
1438 | 1438 |
mocked_post.side_effect = [READ_CATEGORIES, READ_SITUATIONS, READ_CIVILITIES, READ_QUALITIES] |
1439 | 1439 |
url = get_endpoint('create-rl1') |
1440 | 1440 |
params = { |
1441 |
'categorie': 'ACCEUI',
|
|
1441 |
'category': 'ACCEUI',
|
|
1442 | 1442 |
'situation': 'C', |
1443 | 1443 |
'rl1/civility': 'M.', |
1444 | 1444 |
'rl1/firstname': 'Jhon', |
1445 | 1445 |
'rl1/lastname': 'Doe', |
1446 | 1446 |
'rl1/quality': 'AU', |
1447 | 1447 |
'rl1/dateBirth': '1938-07-26', |
1448 | 1448 |
'rl1/adresse/numComp': 'plop', |
1449 | 1449 |
'rl1/adresse/street1': 'Chateau', |
... | ... | |
1467 | 1467 |
READ_CATEGORIES, |
1468 | 1468 |
READ_SITUATIONS, |
1469 | 1469 |
READ_CIVILITIES, |
1470 | 1470 |
READ_QUALITIES, |
1471 | 1471 |
CREATE_FAMILY_ERR, |
1472 | 1472 |
] |
1473 | 1473 |
url = get_endpoint('create-rl1') |
1474 | 1474 |
params = { |
1475 |
'categorie': 'ACCEUI',
|
|
1475 |
'category': 'ACCEUI',
|
|
1476 | 1476 |
'situation': 'C', |
1477 | 1477 |
'rl1/civility': 'M.', |
1478 | 1478 |
'rl1/firstname': 'Jhon', |
1479 | 1479 |
'rl1/lastname': 'Doe', |
1480 | 1480 |
'rl1/quality': 'AU', |
1481 | 1481 |
'rl1/dateBirth': '1938-07-26', |
1482 | 1482 |
'rl1/adresse/street1': 'Chateau', |
1483 | 1483 |
'rl1/adresse/town': 'Paris', |
1484 |
- |