From 949b7072cabce0daed6c94993ad44c8ea8648dbd Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 10 Nov 2017 15:50:40 +0000 Subject: Import py-macaroon-bakery_0.0.6.orig.tar.gz --- docs/conf.py | 2 +- macaroonbakery/httpbakery/agent/agent.py | 9 ++++++--- setup.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index df296f1..a64ec3a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,7 +63,7 @@ copyright = u'2017, Juju UI Team' # the built documents. # # The short X.Y version and the full version. -version = release = '0.0.4' +version = release = '0.0.6' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/macaroonbakery/httpbakery/agent/agent.py b/macaroonbakery/httpbakery/agent/agent.py index 862f00e..ad56015 100644 --- a/macaroonbakery/httpbakery/agent/agent.py +++ b/macaroonbakery/httpbakery/agent/agent.py @@ -6,6 +6,7 @@ import json import nacl.public import nacl.encoding +import nacl.exceptions import requests.cookies import six from six.moves.urllib.parse import urlparse @@ -35,8 +36,10 @@ def load_agent_file(filename, cookies=None): with open(filename) as f: data = json.load(f) try: - key = nacl.public.PrivateKey(data['key']['private'], - nacl.encoding.Base64Encoder) + key = nacl.public.PrivateKey( + data['key']['private'], + nacl.encoding.Base64Encoder, + ) if cookies is None: cookies = requests.cookies.RequestsCookieJar() for agent in data['agents']: @@ -54,7 +57,7 @@ def load_agent_file(filename, cookies=None): path=u.path) cookies.set_cookie(cookie) return cookies, key - except (KeyError, ValueError) as e: + except (KeyError, ValueError, nacl.exceptions.TypeError) as e: raise AgentFileFormatError('invalid agent file', e) diff --git a/setup.py b/setup.py index 340bf3a..40155f9 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import ( PROJECT_NAME = 'macaroonbakery' -VERSION = (0, 0, 5) +VERSION = (0, 0, 6) def get_version(): -- cgit v1.2.3 From 530e1e702c8743fc8ea93db035bf86f6c07e6d09 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 6 Nov 2017 10:27:10 +0000 Subject: Isolate client tests from any HTTP proxy Debian's Python packaging tools set http_proxy to a non-existent proxy to help flush out packages that try to talk to the network during build, but these tests could previously fail in more normal development environments too. Forwarded: https://github.com/go-macaroon-bakery/py-macaroon-bakery/pull/28 Last-Update: 2017-11-06 Patch-Name: isolate-from-proxy.patch --- macaroonbakery/tests/test_client.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macaroonbakery/tests/test_client.py b/macaroonbakery/tests/test_client.py index e1a4009..8263f54 100644 --- a/macaroonbakery/tests/test_client.py +++ b/macaroonbakery/tests/test_client.py @@ -3,6 +3,7 @@ import base64 import datetime import json +import os from unittest import TestCase try: from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler @@ -26,6 +27,12 @@ TEST_OP = bakery.Op(entity='test', action='test') class TestClient(TestCase): + def setUp(self): + super(TestClient, self).setUp() + # http_proxy would cause requests to talk to the proxy, which is + # unlikely to know how to talk to the test server. + os.environ.pop('http_proxy', None) + def test_single_service_first_party(self): b = new_bakery('loc', None, None) -- cgit v1.2.3