Add 01-remove-failing-tests.patch and 02-fix-soap-enc.xsd-copyright-char.patch.

01-remove-failing-tests.patch:
  Remove the tests failing for currently missing build dependencies.
02-fix-soap-enc.xsd-copyright-char.patch:
  Replace a copyright char leading to to build failures in an sbuild
  environment.
This commit is contained in:
Mathias Behrle 2017-06-13 13:52:54 +02:00
parent 2306def205
commit 10c98c637b
3 changed files with 223 additions and 0 deletions

View File

@ -0,0 +1,185 @@
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,112 +0,0 @@
-import os
-import sys
-
-import pytest
-
-from tests.utils import load_xml
-from zeep.exceptions import SignatureVerificationFailed
-from zeep import wsse
-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,60 +0,0 @@
-import pytest
-from pretend import stub
-from lxml import etree
-import aiohttp
-from aioresponses import aioresponses
-
-from zeep import cache, asyncio
-
-
-@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

View File

@ -0,0 +1,36 @@
Description: Replace the copyright sign by ASCII chars
The tests
tests/test_wsdl_arrays.py
tests/test_wsdl_messages_rpc.py
are failing in an sbuild environment with
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 89: ordinal not in range(128)
while they succeed without error in the GitHub CI as well as in a local
virtual environment with tox.
While investigating further this patch replaces for now the offending char.
Author: Mathias Behrle <mbehrle@debian.org>
Bug: http://bugs.tryton.org/issue4280
Forwarded: https://github.com/mvantellingen/python-zeep/issues/290
--- a/tests/wsdl_files/soap-enc.xsd
+++ b/tests/wsdl_files/soap-enc.xsd
@@ -2,8 +2,8 @@
<!-- Schema for the SOAP/1.1 encoding
-Portions © 2001 DevelopMentor.
-© 2001 W3C (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
+Portions Copyright 2001 DevelopMentor.
+Copyright 2001 W3C (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
This document is governed by the W3C Software License [1] as described in the FAQ [2].
[1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
@@ -14,7 +14,7 @@
1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
+2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
3. Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)

2
debian/patches/series vendored Normal file
View File

@ -0,0 +1,2 @@
01-remove-failing-tests.patch
02-fix-soap-enc.xsd-copyright-char.patch