0001-toulouse-axel-fix-link-endpoint-when-SOAPError-is-ra.patch
passerelle/contrib/toulouse_axel/schemas.py | ||
---|---|---|
25 | 25 | |
26 | 26 |
import xmlschema |
27 | 27 | |
28 |
from passerelle.utils.soap import SOAPError |
|
28 | 29 |
from passerelle.utils.xml import JSONSchemaFromXMLSchema |
29 | 30 |
from . import utils |
30 | 31 |
from .exceptions import AxelError |
... | ... | |
124 | 125 |
return schema |
125 | 126 | |
126 | 127 |
def __call__(self, resource, request_data=None): |
127 |
client = resource.soap_client() |
|
128 |
try: |
|
129 |
client = resource.soap_client() |
|
130 |
except SOAPError as e: |
|
131 |
raise AxelError(str(e)) |
|
128 | 132 | |
129 | 133 |
serialized_request = '' |
130 | 134 |
if self.request_converter: |
tests/test_toulouse_axel.py | ||
---|---|---|
49 | 49 |
upperize, |
50 | 50 |
) |
51 | 51 |
from passerelle.utils.jsonresponse import APIError |
52 |
from passerelle.utils.soap import SOAPError |
|
52 | 53 |
import utils |
53 | 54 | |
54 | 55 | |
... | ... | |
593 | 594 |
assert resp.json['data']['xml_request'] == xml_request |
594 | 595 |
assert resp.json['data']['xml_response'] == xml_response |
595 | 596 | |
597 |
with mock.patch('passerelle.contrib.toulouse_axel.models.ToulouseAxel.soap_client') as client: |
|
598 |
client.side_effect = SOAPError('SOAP service is down') |
|
599 |
resp = app.post_json('/toulouse-axel/test/link?NameID=yyy', params=link_params) |
|
600 |
assert resp.json['err_desc'] == "Axel error: SOAP service is down" |
|
601 |
assert resp.json['err'] == 'error' |
|
602 | ||
596 | 603 | |
597 | 604 |
@pytest.mark.parametrize('xml_response', [ |
598 | 605 |
'<IDDUI>XXX</IDDUI><IDPERSONNE/><CODE>0</CODE>', |
599 |
- |