0001-toulouse-axel-fix-link-endpoint-when-SOAPError-is-ra.patch
passerelle/contrib/toulouse_axel/models.py | ||
---|---|---|
173 | 173 |
try: |
174 | 174 |
result = self.check_dui(post_data) |
175 | 175 |
except APIError as e: |
176 |
if e.err_code == 'error': |
|
176 |
if not hasattr(e, 'err_code') or e.err_code == 'error':
|
|
177 | 177 |
raise |
178 | 178 |
raise APIError('Person not found', err_code='not-found') |
179 | 179 |
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'] == "SOAP service is down" |
|
601 | ||
596 | 602 | |
597 | 603 |
@pytest.mark.parametrize('xml_response', [ |
598 | 604 |
'<IDDUI>XXX</IDDUI><IDPERSONNE/><CODE>0</CODE>', |
599 |
- |