commit:     b4abf82e5c60c00d7f5753f46002eae485315019
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 17 20:22:38 2018 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Sat Mar 17 20:23:20 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4abf82e

app-crypt/acme: fixing client regression

Closes: https://bugs.gentoo.org/650604
Package-Manager: Portage-2.3.24, Repoman-2.3.6

 .../{acme-0.22.0.ebuild => acme-0.22.0-r1.ebuild}  |  2 +
 app-crypt/acme/files/0.22.0-fix-client.patch       | 55 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/app-crypt/acme/acme-0.22.0.ebuild 
b/app-crypt/acme/acme-0.22.0-r1.ebuild
similarity index 95%
rename from app-crypt/acme/acme-0.22.0.ebuild
rename to app-crypt/acme/acme-0.22.0-r1.ebuild
index 61035085637..dd86db57739 100644
--- a/app-crypt/acme/acme-0.22.0.ebuild
+++ b/app-crypt/acme/acme-0.22.0-r1.ebuild
@@ -42,6 +42,8 @@ DEPEND="
        >=dev-python/setuptools-1.0[${PYTHON_USEDEP}]
 "
 
+PATCHES=( "${FILESDIR}/0.22.0-fix-client.patch" )
+
 python_test() {
        nosetests -w ${PN} || die
 }

diff --git a/app-crypt/acme/files/0.22.0-fix-client.patch 
b/app-crypt/acme/files/0.22.0-fix-client.patch
new file mode 100644
index 00000000000..589781b0a8d
--- /dev/null
+++ b/app-crypt/acme/files/0.22.0-fix-client.patch
@@ -0,0 +1,55 @@
+From 0131c649d057a513a6bdc0b4b6eac7ea0bd9a9e8 Mon Sep 17 00:00:00 2001
+From: Brad Warren <[email protected]>
+Date: Fri, 16 Mar 2018 18:44:23 -0700
+Subject: [PATCH] Fix acme.client.Client.__init__ (#5747) (#5748)
+
+* fixes #5738
+
+* add test to prevent regressions
+
+(cherry picked from commit ba6bdb50998bd55aeef7972a5c839560e02142f3)
+---
+ acme/acme/client.py      |  5 +++--
+ acme/acme/client_test.py | 10 ++++++++++
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git acme/acme/client.py acme/acme/client.py
+index 9e2478afe4..19615b087b 100644
+--- acme/acme/client.py
++++ acme/acme/client.py
+@@ -259,11 +259,12 @@ def __init__(self, directory, key, alg=jose.RS256, 
verify_ssl=True,
+         """
+         # pylint: disable=too-many-arguments
+         self.key = key
+-        self.net = ClientNetwork(key, alg=alg, verify_ssl=verify_ssl) if net 
is None else net
++        if net is None:
++            net = ClientNetwork(key, alg=alg, verify_ssl=verify_ssl)
+ 
+         if isinstance(directory, six.string_types):
+             directory = messages.Directory.from_json(
+-                self.net.get(directory).json())
++                net.get(directory).json())
+         super(Client, self).__init__(directory=directory,
+             net=net, acme_version=1)
+ 
+diff --git acme/acme/client_test.py acme/acme/client_test.py
+index 00b9e19dd0..be08c2919f 100644
+--- acme/acme/client_test.py
++++ acme/acme/client_test.py
+@@ -299,6 +299,16 @@ def test_init_downloads_directory(self):
+             directory=uri, key=KEY, alg=jose.RS256, net=self.net)
+         self.net.get.assert_called_once_with(uri)
+ 
++    @mock.patch('acme.client.ClientNetwork')
++    def test_init_without_net(self, mock_net):
++        mock_net.return_value = mock.sentinel.net
++        alg = jose.RS256
++        from acme.client import Client
++        self.client = Client(
++            directory=self.directory, key=KEY, alg=alg)
++        mock_net.called_once_with(KEY, alg=alg, verify_ssl=True)
++        self.assertEqual(self.client.net, mock.sentinel.net)
++
+     def test_register(self):
+         # "Instance of 'Field' has no to_json/update member" bug:
+         # pylint: disable=no-member

Reply via email to