app-crypt/acme: fixing client regression
authorMatthew Thode <prometheanfire@gentoo.org>
Sat, 17 Mar 2018 20:22:38 +0000 (15:22 -0500)
committerMatthew Thode <prometheanfire@gentoo.org>
Sat, 17 Mar 2018 20:23:20 +0000 (15:23 -0500)
Closes: https://bugs.gentoo.org/650604
Package-Manager: Portage-2.3.24, Repoman-2.3.6

app-crypt/acme/acme-0.22.0-r1.ebuild [moved from app-crypt/acme/acme-0.22.0.ebuild with 95% similarity]
app-crypt/acme/files/0.22.0-fix-client.patch [new file with mode: 0644]

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 6103508563771397c2c98cfe43cb16bc030df9be..dd86db57739c6f279916612126b66abd3d833314 100644 (file)
@@ -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 (file)
index 0000000..589781b
--- /dev/null
@@ -0,0 +1,55 @@
+From 0131c649d057a513a6bdc0b4b6eac7ea0bd9a9e8 Mon Sep 17 00:00:00 2001
+From: Brad Warren <bmw@users.noreply.github.com>
+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