0003-toulouse_maelis-add-test-on-updateFamily-error-67326.patch
tests/data/toulouse_maelis/R_update_family_error.xml | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> |
3 | 3 |
<soap:Body> |
4 |
<soap:Fault>
|
|
5 |
<faultcode>soap:Server</faultcode>
|
|
6 |
<faultstring>Une erreur est survenue : java.sql.SQLDataException: ORA-01438: valeur incohérente avec la précision indiquée pour cette colonne
|
|
7 |
</faultstring>
|
|
8 |
<detail>
|
|
9 |
<ns1:MaelisFamilyException xmlns:ns1="family.ws.maelis.sigec.com">
|
|
10 |
<message xmlns:ns2="family.ws.maelis.sigec.com">Une erreur est survenue : java.sql.SQLDataException: ORA-01438: valeur incohérente avec la précision indiquée pour cette colonne
|
|
11 |
</message>
|
|
12 |
</ns1:MaelisFamilyException>
|
|
13 |
</detail>
|
|
14 |
</soap:Fault>
|
|
4 |
<ns2:updateFamilyResponse xmlns:ns2="family.ws.maelis.sigec.com">
|
|
5 |
<familyResult>
|
|
6 |
<number>0</number>
|
|
7 |
<RL1>
|
|
8 |
<adresse>
|
|
9 |
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
|
|
10 |
</adresse>
|
|
11 |
</RL1>
|
|
12 |
<childErrorList>E65a : Il existe déjà un enfant correspondant au nom [ZIMMERMAN], prénom [ROBERT], date de naissance [24/05/1941] - Personne n°[614051] - Famille n°[196544]</childErrorList>
|
|
13 |
</familyResult>
|
|
14 |
</ns2:updateFamilyResponse>
|
|
15 | 15 |
</soap:Body> |
16 | 16 |
</soap:Envelope> |
tests/data/toulouse_maelis/R_update_family_soap_error.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> |
|
3 |
<soap:Body> |
|
4 |
<soap:Fault> |
|
5 |
<faultcode>soap:Server</faultcode> |
|
6 |
<faultstring>Une erreur est survenue : java.sql.SQLDataException: ORA-01438: valeur incohérente avec la précision indiquée pour cette colonne |
|
7 |
</faultstring> |
|
8 |
<detail> |
|
9 |
<ns1:MaelisFamilyException xmlns:ns1="family.ws.maelis.sigec.com"> |
|
10 |
<message xmlns:ns2="family.ws.maelis.sigec.com">Une erreur est survenue : java.sql.SQLDataException: ORA-01438: valeur incohérente avec la précision indiquée pour cette colonne |
|
11 |
</message> |
|
12 |
</ns1:MaelisFamilyException> |
|
13 |
</detail> |
|
14 |
</soap:Fault> |
|
15 |
</soap:Body> |
|
16 |
</soap:Envelope> |
tests/test_toulouse_maelis.py | ||
---|---|---|
47 | 47 |
READ_CSP = FakedResponse(content=get_xml_file('R_read_csp_list.xml'), status_code=200) |
48 | 48 |
READ_QUALITIES = FakedResponse(content=get_xml_file('R_read_quality_list.xml'), status_code=200) |
49 | 49 |
READ_SITUATIONS = FakedResponse(content=get_xml_file('R_read_situation_list.xml'), status_code=200) |
50 | 50 |
IS_RL_EXISTS_TRUE = FakedResponse(content=get_xml_file('R_is_rl_exists.xml') % b'true', status_code=200) |
51 | 51 |
IS_RL_EXISTS_FALSE = FakedResponse(content=get_xml_file('R_is_rl_exists.xml') % b'false', status_code=200) |
52 | 52 |
CREATE_FAMILY = FakedResponse(content=get_xml_file('R_create_family.xml'), status_code=200) |
53 | 53 |
CREATE_FAMILY_ERR = FakedResponse(content=get_xml_file('R_create_family_error.xml'), status_code=200) |
54 | 54 |
UPDATE_FAMILY = FakedResponse(content=get_xml_file('R_update_family.xml'), status_code=200) |
55 |
UPDATE_FAMILY_500 = FakedResponse(content=get_xml_file('R_update_family_error.xml'), status_code=500) |
|
55 |
UPDATE_FAMILY_ERR = FakedResponse(content=get_xml_file('R_update_family_error.xml'), status_code=200) |
|
56 |
UPDATE_FAMILY_500 = FakedResponse(content=get_xml_file('R_update_family_soap_error.xml'), status_code=500) |
|
56 | 57 | |
57 | 58 | |
58 | 59 |
def assert_sent_payload(mocked_post, query_file): |
59 | 60 |
soap_sent = etree.tostring(etree.fromstring(mocked_post.call_args.kwargs['data']), pretty_print=True) |
60 | 61 |
expected = etree.tostring(etree.fromstring(get_xml_file(query_file)), pretty_print=True) |
61 | 62 |
assert soap_sent.decode() == expected.decode() |
62 | 63 | |
63 | 64 | |
... | ... | |
682 | 683 |
'rl1/adresse/zipcode': '75014', |
683 | 684 |
} |
684 | 685 | |
685 | 686 |
resp = app.post_json(url + '?NameID=local', params=params) |
686 | 687 |
assert resp.json['err'] == 'not-linked' |
687 | 688 |
assert resp.json['err_desc'] == 'User not linked to family' |
688 | 689 | |
689 | 690 | |
691 |
@mock.patch('passerelle.utils.Request.get') |
|
692 |
@mock.patch('passerelle.utils.Request.post') |
|
693 |
def test_update_family_maelis_error(mocked_post, mocked_get, con, app): |
|
694 |
mocked_get.return_value = FAMILY_SERVICE_WSDL |
|
695 |
mocked_post.return_value = UPDATE_FAMILY_ERR |
|
696 |
url = get_endpoint('update-family') |
|
697 |
params = { |
|
698 |
'categorie': 'ACCEUI', |
|
699 |
'situation': 'C', |
|
700 |
'childList/0/lastname': 'Zimmerman', |
|
701 |
'childList/0/firstname': 'Robert', |
|
702 |
'childList/0/sexe': 'M', |
|
703 |
'childList/0/birth/dateBirth': '1941-05-24', |
|
704 |
'childList/0/birth/place': 'Duluth', |
|
705 |
} |
|
706 | ||
707 |
Link.objects.create(resource=con, family_id='1312', name_id='local') |
|
708 |
# get 500 because error repsonse is wrongly formatted |
|
709 |
resp = app.post_json(url + '?NameID=local', params=params, status=500) |
|
710 |
assert resp.json == { |
|
711 |
'err': 1, |
|
712 |
'err_class': 'zeep.exceptions.XMLParseError', |
|
713 |
'err_desc': "Unexpected element 'adresse', expected 'lastname'", |
|
714 |
'data': None, |
|
715 |
} |
|
716 | ||
717 | ||
690 | 718 |
@mock.patch('passerelle.utils.Request.get') |
691 | 719 |
@mock.patch('passerelle.utils.Request.post') |
692 | 720 |
def test_update_family_soap_error(mocked_post, mocked_get, con, app): |
693 | 721 |
mocked_get.return_value = FAMILY_SERVICE_WSDL |
694 | 722 |
mocked_post.return_value = UPDATE_FAMILY_500 |
695 | 723 |
url = get_endpoint('update-family') |
696 | 724 |
params = { |
697 | 725 |
'nbChild': '100', |
698 |
- |