parent
2eb315b1d0
commit
be25c9028d
|
@ -36,6 +36,9 @@ from tests.test_manager import login
|
|||
from tests.utils import FakedResponse, ResponsesSoap, generic_endpoint_url, setup_access_rights
|
||||
|
||||
TEST_BASE_DIR = os.path.join(os.path.dirname(__file__), 'data', 'toulouse_maelis')
|
||||
TOOLS_BASE_DIR = os.path.join(
|
||||
os.path.dirname(__file__), '..', 'passerelle', 'contrib', 'toulouse_maelis', 'tools'
|
||||
)
|
||||
|
||||
|
||||
def get_xml_file(filename):
|
||||
|
@ -48,12 +51,17 @@ def get_media_file(filename):
|
|||
return desc.read()
|
||||
|
||||
|
||||
def get_wsdl_file(filename):
|
||||
with open(os.path.join(TOOLS_BASE_DIR, filename), 'rb') as desc:
|
||||
return desc.read()
|
||||
|
||||
|
||||
CONNECTION_ERROR = ConnectionError('No address associated with hostname')
|
||||
FAMILY_SERVICE_WSDL = FakedResponse(content=get_xml_file('FamilyService.wsdl'), status_code=200)
|
||||
ACTIVITY_SERVICE_WSDL = FakedResponse(content=get_xml_file('ActivityService.wsdl'), status_code=200)
|
||||
INVOICE_SERVICE_WSDL = FakedResponse(content=get_xml_file('InvoiceService.wsdl'), status_code=200)
|
||||
SITE_SERVICE_WSDL = FakedResponse(content=get_xml_file('SiteService.wsdl'), status_code=200)
|
||||
APE_SERVICE_WSDL = FakedResponse(content=get_xml_file('ApeService.wsdl'), status_code=200)
|
||||
FAMILY_SERVICE_WSDL = FakedResponse(content=get_wsdl_file('FamilyService.wsdl'), status_code=200)
|
||||
ACTIVITY_SERVICE_WSDL = FakedResponse(content=get_wsdl_file('ActivityService.wsdl'), status_code=200)
|
||||
INVOICE_SERVICE_WSDL = FakedResponse(content=get_wsdl_file('InvoiceService.wsdl'), status_code=200)
|
||||
SITE_SERVICE_WSDL = FakedResponse(content=get_wsdl_file('SiteService.wsdl'), status_code=200)
|
||||
APE_SERVICE_WSDL = FakedResponse(content=get_wsdl_file('ApeService.wsdl'), status_code=200)
|
||||
FAILED_AUTH = FakedResponse(content=get_xml_file('R_failed_authentication.xml'), status_code=500)
|
||||
ISWSRUNNING_TRUE = FakedResponse(content=get_xml_file('R_is_ws_running.xml') % b'true', status_code=200)
|
||||
ISWSRUNNING_FALSE = FakedResponse(content=get_xml_file('R_is_ws_running.xml') % b'false', status_code=200)
|
||||
|
@ -74,7 +82,7 @@ def requests_mock():
|
|||
def family_service(requests_mock):
|
||||
responses_soap = ResponsesSoap(
|
||||
wsdl_url='https://example.org/FamilyService?wsdl',
|
||||
wsdl_content=get_xml_file('FamilyService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('FamilyService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
requests_mock=requests_mock,
|
||||
)
|
||||
|
@ -86,7 +94,7 @@ def family_service(requests_mock):
|
|||
def activity_service(requests_mock):
|
||||
responses_soap = ResponsesSoap(
|
||||
wsdl_url='https://example.org/ActivityService?wsdl',
|
||||
wsdl_content=get_xml_file('ActivityService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('ActivityService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
requests_mock=requests_mock,
|
||||
)
|
||||
|
@ -98,7 +106,7 @@ def activity_service(requests_mock):
|
|||
def invoice_service(requests_mock):
|
||||
responses_soap = ResponsesSoap(
|
||||
wsdl_url='https://example.org/InvoiceService?wsdl',
|
||||
wsdl_content=get_xml_file('InvoiceService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('InvoiceService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
requests_mock=requests_mock,
|
||||
)
|
||||
|
@ -110,7 +118,7 @@ def invoice_service(requests_mock):
|
|||
def site_service(requests_mock):
|
||||
responses_soap = ResponsesSoap(
|
||||
wsdl_url='https://example.org/SiteService?wsdl',
|
||||
wsdl_content=get_xml_file('SiteService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('SiteService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
requests_mock=requests_mock,
|
||||
)
|
||||
|
@ -122,7 +130,7 @@ def site_service(requests_mock):
|
|||
def ape_service():
|
||||
with ResponsesSoap(
|
||||
wsdl_url='https://example.org/ApeService?wsdl',
|
||||
wsdl_content=get_xml_file('ApeService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('ApeService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
)() as mock:
|
||||
yield mock
|
||||
|
@ -144,31 +152,31 @@ def django_db_setup(django_db_setup, django_db_blocker):
|
|||
|
||||
site_service = ResponsesSoap(
|
||||
wsdl_url='https://example.org/SiteService?wsdl',
|
||||
wsdl_content=get_xml_file('SiteService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('SiteService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
)
|
||||
|
||||
family_service = ResponsesSoap(
|
||||
wsdl_url='https://example.org/FamilyService?wsdl',
|
||||
wsdl_content=get_xml_file('FamilyService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('FamilyService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
)
|
||||
|
||||
activity_service = ResponsesSoap(
|
||||
wsdl_url='https://example.org/ActivityService?wsdl',
|
||||
wsdl_content=get_xml_file('ActivityService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('ActivityService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
)
|
||||
|
||||
ape_service = ResponsesSoap(
|
||||
wsdl_url='https://example.org/ApeService?wsdl',
|
||||
wsdl_content=get_xml_file('ApeService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('ApeService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
)
|
||||
|
||||
invoice_service = ResponsesSoap(
|
||||
wsdl_url='https://example.org/InvoiceService?wsdl',
|
||||
wsdl_content=get_xml_file('InvoiceService.wsdl'),
|
||||
wsdl_content=get_wsdl_file('InvoiceService.wsdl'),
|
||||
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue