Fix failing tests.
Modernize the SPEC file.
This commit is contained in:
parent
b3f180f146
commit
00159b377c
57
fix-failing-tests.patch
Normal file
57
fix-failing-tests.patch
Normal file
@ -0,0 +1,57 @@
|
||||
From d9923b582a31cafce75ddd3a97857fa1794e22ca Mon Sep 17 00:00:00 2001
|
||||
From: Christian Heimes <cheimes@redhat.com>
|
||||
Date: Wed, 4 Jan 2017 15:02:00 +0100
|
||||
Subject: [PATCH] Fix tests
|
||||
|
||||
Python 2's mock is no longer compatible to more recent versions of
|
||||
Python's socket module. Tests are still fine without the autospec
|
||||
feature.
|
||||
|
||||
More recent versions of pytests refuse to load tests because pytest
|
||||
considers webtest.TestApp as a test class with a non-trival __init__.
|
||||
|
||||
Signed-off-by: Christian Heimes <cheimes@redhat.com>
|
||||
---
|
||||
tests.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests.py b/tests.py
|
||||
index 836f77b..9679823 100644
|
||||
--- a/tests.py
|
||||
+++ b/tests.py
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
from pyasn1.codec.der import decoder, encoder
|
||||
|
||||
-from webtest import TestApp
|
||||
+from webtest import TestApp as WebTestApp
|
||||
|
||||
import kdcproxy
|
||||
# from kdcproxy import asn1
|
||||
@@ -59,7 +59,7 @@ def setUp(self): # noqa
|
||||
self.await_reply.return_value = b'RESPONSE'
|
||||
self.resolver = self.app._Application__resolver = mock.Mock()
|
||||
self.resolver.lookup.return_value = ["kerberos://k1.kdcproxy.test.:88"]
|
||||
- self.tapp = TestApp(self.app)
|
||||
+ self.tapp = WebTestApp(self.app)
|
||||
|
||||
def post(self, body, expect_errors=False):
|
||||
return self.tapp.post(
|
||||
@@ -79,7 +79,7 @@ def test_get(self):
|
||||
self.assertEqual(r.text, 'Method not allowed (GET).')
|
||||
|
||||
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
|
||||
- @mock.patch('socket.socket', autospec=True)
|
||||
+ @mock.patch('socket.socket')
|
||||
def test_post_asreq(self, m_socket, m_getaddrinfo):
|
||||
response = self.post(KDCProxyCodecTests.asreq1)
|
||||
self.assert_response(response)
|
||||
@@ -92,7 +92,7 @@ def test_post_asreq(self, m_socket, m_getaddrinfo):
|
||||
)
|
||||
|
||||
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
|
||||
- @mock.patch('socket.socket', autospec=True)
|
||||
+ @mock.patch('socket.socket')
|
||||
def test_post_kpasswd(self, m_socket, m_getaddrinfo):
|
||||
response = self.post(KDCProxyCodecTests.kpasswdreq)
|
||||
self.assert_response(response)
|
@ -2,24 +2,27 @@
|
||||
|
||||
Name: python-%{realname}
|
||||
Version: 0.3.2
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Summary: MS-KKDCP (kerberos proxy) WSGI module
|
||||
|
||||
License: MIT
|
||||
URL: https://github.com/npmccallum/%{realname}
|
||||
Source0: https://github.com/npmccallum/%{realname}/archive/v%{version}.tar.gz
|
||||
# Fix failing tests
|
||||
# Commited upstream: https://github.com/latchset/kdcproxy/commit/d9923b582a31cafce75ddd3a97857fa1794e22ca
|
||||
Patch0: fix-failing-tests.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: python2-devel
|
||||
|
||||
%if 0%{?rhel} == 0
|
||||
BuildRequires: /usr/bin/tox
|
||||
BuildRequires: pytest
|
||||
BuildRequires: python-coverage
|
||||
BuildRequires: python2-pytest
|
||||
BuildRequires: python2-coverage
|
||||
BuildRequires: python-webtest
|
||||
BuildRequires: python-pyasn1
|
||||
BuildRequires: python-dns
|
||||
BuildRequires: python-mock
|
||||
BuildRequires: python2-pyasn1
|
||||
BuildRequires: python2-dns
|
||||
BuildRequires: python2-mock
|
||||
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-pytest
|
||||
@ -30,10 +33,20 @@ BuildRequires: python3-dns
|
||||
BuildRequires: python3-mock
|
||||
%endif
|
||||
|
||||
Requires: python-dns
|
||||
Requires: python-pyasn1
|
||||
|
||||
%description
|
||||
This package contains a Python WSGI module for proxying KDC requests over
|
||||
HTTP by following the MS-KKDCP protocol. It aims to be simple to deploy, with
|
||||
minimal configuration.
|
||||
|
||||
%package -n python2-%{realname}
|
||||
Summary: MS-KKDCP (kerberos proxy) WSGI module
|
||||
Requires: python2-dns
|
||||
Requires: python2-pyasn1
|
||||
|
||||
%{?python_provide:%python_provide python2-%{realname}}
|
||||
|
||||
%description -n python2-%{realname}
|
||||
This package contains a Python 2.x WSGI module for proxying KDC requests over
|
||||
HTTP by following the MS-KKDCP protocol. It aims to be simple to deploy, with
|
||||
minimal configuration.
|
||||
@ -44,6 +57,8 @@ Summary: MS-KKDCP (kerberos proxy) WSGI module
|
||||
Requires: python3-dns
|
||||
Requires: python3-pyasn1
|
||||
|
||||
%{?python_provide:%python_provide python3-%{realname}}
|
||||
|
||||
%description -n python3-%{realname}
|
||||
This package contains a Python 3.x WSGI module for proxying KDC requests over
|
||||
HTTP by following the MS-KKDCP protocol. It aims to be simple to deploy, with
|
||||
@ -52,6 +67,7 @@ minimal configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{realname}-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
@ -71,19 +87,25 @@ find $RPM_BUILD_ROOT%{python3_sitelib}/%{realname}/ -name '*.py' -exec chmod 755
|
||||
tox --sitepackages -e py27,py%{python3_version_nodots}
|
||||
%endif
|
||||
|
||||
%files
|
||||
%doc COPYING README
|
||||
%files -n python2-%{realname}
|
||||
%doc README
|
||||
%license COPYING
|
||||
%{python_sitelib}/%{realname}
|
||||
%{python_sitelib}/%{realname}-%{version}-*.egg-info
|
||||
|
||||
%if 0%{?rhel} == 0
|
||||
%files -n python3-%{realname}
|
||||
%doc COPYING README
|
||||
%doc README
|
||||
%license COPYING
|
||||
%{python3_sitelib}/%{realname}
|
||||
%{python3_sitelib}/%{realname}-%{version}-*.egg-info
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jan 16 2017 Charalampos Stratakis <cstratak@redhat.com> - 0.3.2-6
|
||||
- Fix failing tests
|
||||
- Modernize the SPEC file
|
||||
|
||||
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.3.2-5
|
||||
- Rebuild for Python 3.6
|
||||
- BR /usr/bin/tox instead of python-tox
|
||||
|
Loading…
Reference in New Issue
Block a user