203 lines
6.5 KiB
Diff
203 lines
6.5 KiB
Diff
Description: Remove some failing tests due to missing build dependencies
|
|
The following tests fail due to missing build dependencies
|
|
tests/test_wsse_signature.py: xmlsec
|
|
tests/test_asyncio_transport.py: aioresponses
|
|
Author: Mathias Behrle <mbehrle@debian.org>
|
|
Forwarded: not needed
|
|
|
|
--- a/tests/test_wsse_signature.py
|
|
+++ /dev/null
|
|
@@ -1,113 +0,0 @@
|
|
-import os
|
|
-import sys
|
|
-
|
|
-import pytest
|
|
-from lxml import etree
|
|
-
|
|
-from tests.utils import load_xml
|
|
-from zeep import wsse
|
|
-from zeep.exceptions import SignatureVerificationFailed
|
|
-from zeep.wsse import signature
|
|
-
|
|
-DS_NS = 'http://www.w3.org/2000/09/xmldsig#'
|
|
-
|
|
-
|
|
-KEY_FILE = os.path.join(
|
|
- os.path.dirname(os.path.realpath(__file__)), 'cert_valid.pem')
|
|
-KEY_FILE_PW = os.path.join(
|
|
- os.path.dirname(os.path.realpath(__file__)), 'cert_valid_pw.pem')
|
|
-
|
|
-
|
|
-@pytest.mark.skipif(sys.platform == 'win32',
|
|
- reason="does not run on windows")
|
|
-def test_sign():
|
|
- envelope = load_xml("""
|
|
- <soapenv:Envelope
|
|
- xmlns:tns="http://tests.python-zeep.org/"
|
|
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
|
- xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
|
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
|
- <soapenv:Header></soapenv:Header>
|
|
- <soapenv:Body>
|
|
- <tns:Function>
|
|
- <tns:Argument>OK</tns:Argument>
|
|
- </tns:Function>
|
|
- </soapenv:Body>
|
|
- </soapenv:Envelope>
|
|
- """)
|
|
-
|
|
- signature.sign_envelope(envelope, KEY_FILE, KEY_FILE)
|
|
- signature.verify_envelope(envelope, KEY_FILE)
|
|
-
|
|
-
|
|
-@pytest.mark.skipif(sys.platform == 'win32',
|
|
- reason="does not run on windows")
|
|
-def test_sign_pw():
|
|
- envelope = load_xml("""
|
|
- <soapenv:Envelope
|
|
- xmlns:tns="http://tests.python-zeep.org/"
|
|
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
|
- xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
|
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
|
- <soapenv:Header></soapenv:Header>
|
|
- <soapenv:Body>
|
|
- <tns:Function>
|
|
- <tns:Argument>OK</tns:Argument>
|
|
- </tns:Function>
|
|
- </soapenv:Body>
|
|
- </soapenv:Envelope>
|
|
- """)
|
|
-
|
|
- signature.sign_envelope(envelope, KEY_FILE_PW, KEY_FILE_PW, 'geheim')
|
|
- signature.verify_envelope(envelope, KEY_FILE_PW)
|
|
-
|
|
-
|
|
-@pytest.mark.skipif(sys.platform == 'win32',
|
|
- reason="does not run on windows")
|
|
-def test_verify_error():
|
|
- envelope = load_xml("""
|
|
- <soapenv:Envelope
|
|
- xmlns:tns="http://tests.python-zeep.org/"
|
|
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
|
- xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
|
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
|
- <soapenv:Header></soapenv:Header>
|
|
- <soapenv:Body>
|
|
- <tns:Function>
|
|
- <tns:Argument>OK</tns:Argument>
|
|
- </tns:Function>
|
|
- </soapenv:Body>
|
|
- </soapenv:Envelope>
|
|
- """)
|
|
-
|
|
- signature.sign_envelope(envelope, KEY_FILE, KEY_FILE)
|
|
- nsmap = {'tns': 'http://tests.python-zeep.org/'}
|
|
-
|
|
- for elm in envelope.xpath('//tns:Argument', namespaces=nsmap):
|
|
- elm.text = 'NOT!'
|
|
-
|
|
- with pytest.raises(SignatureVerificationFailed):
|
|
- signature.verify_envelope(envelope, KEY_FILE)
|
|
-
|
|
-
|
|
-@pytest.mark.skipif(sys.platform == 'win32',
|
|
- reason="does not run on windows")
|
|
-def test_signature():
|
|
- envelope = load_xml("""
|
|
- <soapenv:Envelope
|
|
- xmlns:tns="http://tests.python-zeep.org/"
|
|
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
|
- xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
|
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
|
- <soapenv:Header></soapenv:Header>
|
|
- <soapenv:Body>
|
|
- <tns:Function>
|
|
- <tns:Argument>OK</tns:Argument>
|
|
- </tns:Function>
|
|
- </soapenv:Body>
|
|
- </soapenv:Envelope>
|
|
- """)
|
|
-
|
|
- plugin = wsse.Signature(KEY_FILE_PW, KEY_FILE_PW, 'geheim')
|
|
- envelope, headers = plugin.apply(envelope, {})
|
|
- plugin.verify(envelope)
|
|
--- a/tests/test_asyncio_transport.py
|
|
+++ /dev/null
|
|
@@ -1,76 +0,0 @@
|
|
-import pytest
|
|
-from pretend import stub
|
|
-from lxml import etree
|
|
-import aiohttp
|
|
-from aioresponses import aioresponses
|
|
-
|
|
-from zeep import cache, asyncio, exceptions
|
|
-
|
|
-
|
|
-@pytest.mark.requests
|
|
-def test_no_cache(event_loop):
|
|
- transport = asyncio.AsyncTransport(loop=event_loop)
|
|
- assert transport.cache is None
|
|
-
|
|
-
|
|
-@pytest.mark.requests
|
|
-def test_load(event_loop):
|
|
- cache = stub(get=lambda url: None, add=lambda url, content: None)
|
|
- transport = asyncio.AsyncTransport(loop=event_loop, cache=cache)
|
|
-
|
|
- with aioresponses() as m:
|
|
- m.get('http://tests.python-zeep.org/test.xml', body='x')
|
|
- result = transport.load('http://tests.python-zeep.org/test.xml')
|
|
- assert result == b'x'
|
|
-
|
|
-
|
|
-@pytest.mark.requests
|
|
-@pytest.mark.asyncio
|
|
-async def test_post(event_loop):
|
|
- cache = stub(get=lambda url: None, add=lambda url, content: None)
|
|
- transport = asyncio.AsyncTransport(loop=event_loop, cache=cache)
|
|
-
|
|
- envelope = etree.Element('Envelope')
|
|
-
|
|
- with aioresponses() as m:
|
|
- m.post('http://tests.python-zeep.org/test.xml', body='x')
|
|
- result = await transport.post_xml(
|
|
- 'http://tests.python-zeep.org/test.xml',
|
|
- envelope=envelope,
|
|
- headers={})
|
|
-
|
|
- assert result.content == b'x'
|
|
-
|
|
-
|
|
-@pytest.mark.requests
|
|
-@pytest.mark.asyncio
|
|
-async def test_session_close(event_loop):
|
|
- transport = asyncio.AsyncTransport(loop=event_loop)
|
|
- session = transport.session # copy session object from transport
|
|
- del transport
|
|
- assert session.closed
|
|
-
|
|
-
|
|
-@pytest.mark.requests
|
|
-@pytest.mark.asyncio
|
|
-async def test_session_no_close(event_loop):
|
|
- session = aiohttp.ClientSession(loop=event_loop)
|
|
- transport = asyncio.AsyncTransport(loop=event_loop, session=session)
|
|
- del transport
|
|
- assert not session.closed
|
|
-
|
|
-
|
|
-@pytest.mark.requests
|
|
-def test_http_error(event_loop):
|
|
- transport = asyncio.AsyncTransport(loop=event_loop)
|
|
-
|
|
- with aioresponses() as m:
|
|
- m.get(
|
|
- 'http://tests.python-zeep.org/test.xml',
|
|
- body='x',
|
|
- status=500,
|
|
- )
|
|
- with pytest.raises(exceptions.TransportError) as exc:
|
|
- transport.load('http://tests.python-zeep.org/test.xml')
|
|
- assert exc.value.status_code == 500
|
|
- assert exc.value.message is None
|