Revert "toulouse-maelis: add wrapping of zeep errors inside APIError (#73411)"
This reverts commit 47e0b644a5
.
This commit is contained in:
parent
250100fb83
commit
9cd4059284
|
@ -32,7 +32,6 @@ from passerelle.base.models import BaseResource, HTTPResource
|
|||
from passerelle.utils.api import endpoint
|
||||
from passerelle.utils.conversion import simplify
|
||||
from passerelle.utils.jsonresponse import APIError
|
||||
from passerelle.utils.soap import SOAPError
|
||||
from passerelle.utils.templates import render_to_string
|
||||
|
||||
from . import activity_schemas, family_schemas, invoice_schemas, schemas, utils
|
||||
|
@ -69,16 +68,15 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
wsdl_name = wsdl_short_name + 'Service?wsdl'
|
||||
wsdl_url = urljoin(self.base_wsdl_url, wsdl_name)
|
||||
settings = zeep.Settings(strict=False, xsd_ignore_sequence_order=True)
|
||||
return self.soap_client(wsdl_url=wsdl_url, wsse=wsse, settings=settings, api_error=True)
|
||||
return self.soap_client(wsdl_url=wsdl_url, wsse=wsse, settings=settings)
|
||||
|
||||
def call(self, wsdl_short_name, service, **kwargs):
|
||||
client = self.get_client(wsdl_short_name)
|
||||
method = getattr(client.service, service)
|
||||
try:
|
||||
return method(**kwargs)
|
||||
except SOAPError as e:
|
||||
e.err_code = '%s-%s-%s' % (wsdl_short_name, service, e.data['soap_fault']['code'])
|
||||
raise
|
||||
except zeep.exceptions.Fault as e:
|
||||
raise APIError(e.message, err_code='%s-%s-%s' % (wsdl_short_name, service, e.code))
|
||||
|
||||
def check_status(self):
|
||||
assert self.call('Family', 'isWSRunning')
|
||||
|
|
|
@ -3659,10 +3659,7 @@ def test_add_rl1_direct_debit_order_soap_error(family_service, invoice_service,
|
|||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
resp = app.post_json(url + '?NameID=local', params=params)
|
||||
assert resp.json['err'] == 'Invoice-addDirectDebitOrder-soap:Server'
|
||||
assert (
|
||||
resp.json['err_desc']
|
||||
== 'SOAP service at https://example.org/InvoiceService?wsdl returned an error "E520 : La REGIE CS [{0}] n\'\'existe pas dans la base Maelis"'
|
||||
)
|
||||
assert resp.json['err_desc'] == "E520 : La REGIE CS [{0}] n''existe pas dans la base Maelis"
|
||||
|
||||
|
||||
def test_get_rl1_direct_debit_order(family_service, invoice_service, con, app):
|
||||
|
@ -3738,10 +3735,7 @@ def test_get_rl1_direct_debit_order_soap_error(family_service, invoice_service,
|
|||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
resp = app.get(url + '?NameID=local', params=params)
|
||||
assert resp.json['err'] == 'Invoice-getDirectDebitOrder-soap:Server'
|
||||
assert (
|
||||
resp.json['err_desc']
|
||||
== 'SOAP service at https://example.org/InvoiceService?wsdl returned an error "E520 : La REGIE CS [{0}] n\'\'existe pas dans la base Maelis"'
|
||||
)
|
||||
assert resp.json['err_desc'] == "E520 : La REGIE CS [{0}] n''existe pas dans la base Maelis"
|
||||
|
||||
|
||||
def test_read_school_year_list(con, app):
|
||||
|
@ -4424,8 +4418,8 @@ def test_read_school_list_address_and_level_soap_error(site_service, con, app):
|
|||
'readSchoolForAdressAndLevel', get_xml_file('R_read_school_for_adress_and_level_soap_error.xml'), status=500,
|
||||
)
|
||||
url = get_endpoint('read-schools-for-address-and-level')
|
||||
with pytest.raises(TypeError, match='Object of type _Element is not JSON serializable') as e:
|
||||
resp = app.get(url, params={'id_street': '', 'num': '', 'year': ''})
|
||||
resp = app.get(url, params={'id_street': '', 'num': '', 'year': ''})
|
||||
assert resp.json['err'] == 'Site-readSchoolForAdressAndLevel-soap:Server'
|
||||
|
||||
|
||||
def test_read_school_list_child_and_level(family_service, con, app):
|
||||
|
|
Loading…
Reference in New Issue