14 |
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15 |
15 |
|
16 |
16 |
import datetime
|
17 |
17 |
import logging
|
18 |
18 |
import os
|
19 |
19 |
from unittest import mock
|
20 |
20 |
|
21 |
21 |
import pytest
|
|
22 |
import responses
|
22 |
23 |
from requests.exceptions import ConnectionError
|
23 |
24 |
from zeep import Settings
|
24 |
25 |
|
25 |
26 |
from passerelle.contrib.toulouse_maelis.models import Link, Referential, ToulouseMaelis
|
26 |
27 |
from passerelle.utils.jsonresponse import APIError
|
27 |
28 |
from passerelle.utils.soap import SOAPError
|
28 |
29 |
from tests.utils import FakedResponse, ResponsesSoap, generic_endpoint_url, setup_access_rights
|
29 |
30 |
|
... | ... | |
88 |
89 |
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
89 |
90 |
)
|
90 |
91 |
invoice_service = ResponsesSoap(
|
91 |
92 |
wsdl_url='https://example.org/InvoiceService?wsdl',
|
92 |
93 |
wsdl_content=get_xml_file('InvoiceService.wsdl'),
|
93 |
94 |
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
94 |
95 |
)
|
95 |
96 |
with responses.RequestsMock() as mock:
|
|
97 |
mock.soap_requests = []
|
96 |
98 |
mock.add(responses.GET, family_service.wsdl_url, body=family_service.wsdl_content, status=200)
|
97 |
99 |
mock.add(responses.GET, invoice_service.wsdl_url, body=invoice_service.wsdl_content, status=200)
|
98 |
100 |
|
99 |
101 |
def add_soap_response(service, *args, **kwargs):
|
100 |
102 |
if service == 'family':
|
101 |
103 |
family_service.add_soap_response(mock, *args, **kwargs)
|
102 |
104 |
elif service == 'invoice':
|
103 |
105 |
invoice_service.add_soap_response(mock, *args, **kwargs)
|
104 |
|
-
|