summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/.git-dpm14
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/improve-unknown-interaction-mock.patch2
-rw-r--r--debian/patches/isolate-from-proxy.patch2
-rwxr-xr-xdocs/conf.py2
-rw-r--r--macaroonbakery/httpbakery/agent/_agent.py13
-rw-r--r--macaroonbakery/tests/test_agent.py19
-rwxr-xr-xsetup.py2
8 files changed, 37 insertions, 23 deletions
diff --git a/debian/.git-dpm b/debian/.git-dpm
index 8a9d05a..77259fe 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,11 +1,11 @@
# see git-dpm(1) from git-dpm package
-ce949d55b30a9ac5a74439727aacf0fab004d6cf
-ce949d55b30a9ac5a74439727aacf0fab004d6cf
-9e4403035a9953c99117083e6373ae3c441a76b5
-9e4403035a9953c99117083e6373ae3c441a76b5
-py-macaroon-bakery_1.1.0.orig.tar.gz
-690a8b89539dd1e2ade3f11481b2a56d8d55d281
-82188
+c1850c8a10886894255100fae185c450e800564a
+c1850c8a10886894255100fae185c450e800564a
+dfa331b7d67b5d89f2fdbe0406374810aaf33b57
+dfa331b7d67b5d89f2fdbe0406374810aaf33b57
+py-macaroon-bakery_1.1.2.orig.tar.gz
+62cbacb048ef5de21894228e3fa8934eae960591
+82228
debianTag="debian/%e%v"
patchedTag="patched/%e%v"
upstreamTag="upstream/%e%u"
diff --git a/debian/changelog b/debian/changelog
index 3ca66c9..6a193ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+py-macaroon-bakery (1.1.2-1) UNRELEASED; urgency=medium
+
+ * New upstream release.
+
+ -- Colin Watson <cjwatson@debian.org> Tue, 20 Feb 2018 18:32:29 +0000
+
py-macaroon-bakery (1.1.0-2) unstable; urgency=medium
* Move VCS to salsa.debian.org.
diff --git a/debian/patches/improve-unknown-interaction-mock.patch b/debian/patches/improve-unknown-interaction-mock.patch
index 0ba7a7e..c885b7a 100644
--- a/debian/patches/improve-unknown-interaction-mock.patch
+++ b/debian/patches/improve-unknown-interaction-mock.patch
@@ -1,4 +1,4 @@
-From ce949d55b30a9ac5a74439727aacf0fab004d6cf Mon Sep 17 00:00:00 2001
+From c1850c8a10886894255100fae185c450e800564a Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Fri, 9 Feb 2018 21:54:21 +0000
Subject: Improve mock setup for 407-then-unknown test
diff --git a/debian/patches/isolate-from-proxy.patch b/debian/patches/isolate-from-proxy.patch
index 46df46e..2648b94 100644
--- a/debian/patches/isolate-from-proxy.patch
+++ b/debian/patches/isolate-from-proxy.patch
@@ -1,4 +1,4 @@
-From 00ab469a4ae426c346228bd68eabe0fd4e689e4c Mon Sep 17 00:00:00 2001
+From 68863455145e5ca2ff2091c1e5c31b2a6bf05140 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Mon, 6 Nov 2017 10:27:10 +0000
Subject: Isolate client tests from any HTTP proxy
diff --git a/docs/conf.py b/docs/conf.py
index ff5c82e..7985e17 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 = '1.1.0'
+version = release = '1.1.2'
# 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 b717261..618097c 100644
--- a/macaroonbakery/httpbakery/agent/_agent.py
+++ b/macaroonbakery/httpbakery/agent/_agent.py
@@ -109,14 +109,15 @@ class AgentInteractor(httpbakery.Interactor, httpbakery.LegacyInteractor):
if not location.endswith('/'):
location += '/'
login_url = urljoin(location, p.login_url)
- # TODO use client to make the request.
- resp = requests.get(login_url, json={
- 'Username': agent.username,
- 'PublicKey': str(self._auth_info.key),
- })
+ resp = requests.get(
+ login_url, params={
+ 'username': agent.username,
+ 'public-key': str(self._auth_info.key.public_key)},
+ auth=client.auth())
if resp.status_code != 200:
raise httpbakery.InteractionError(
- 'cannot acquire agent macaroon: {}'.format(resp.status_code)
+ 'cannot acquire agent macaroon: {} {}'.format(
+ resp.status_code, resp.text)
)
m = resp.json().get('macaroon')
if m is None:
diff --git a/macaroonbakery/tests/test_agent.py b/macaroonbakery/tests/test_agent.py
index 3b38337..d670485 100644
--- a/macaroonbakery/tests/test_agent.py
+++ b/macaroonbakery/tests/test_agent.py
@@ -14,10 +14,13 @@ import macaroonbakery.httpbakery.agent as agent
import requests.cookies
from httmock import HTTMock, response, urlmatch
-from six.moves.urllib.parse import parse_qs
+from six.moves.urllib.parse import parse_qs, urlparse
log = logging.getLogger(__name__)
+PRIVATE_KEY = 'CqoSgj06Zcgb4/S6RT4DpTjLAfKoznEY3JsShSjKJEU='
+PUBLIC_KEY = 'YAhRSsth3a36mRYqQGQaLiS4QJax0p356nd+B8x7UQE='
+
class TestAgents(TestCase):
def setUp(self):
@@ -41,8 +44,8 @@ class TestAgents(TestCase):
def test_load_auth_info(self):
auth_info = agent.load_auth_info(self.agent_filename)
- self.assertEqual(str(auth_info.key), 'CqoSgj06Zcgb4/S6RT4DpTjLAfKoznEY3JsShSjKJEU=')
- self.assertEqual(str(auth_info.key.public_key), 'YAhRSsth3a36mRYqQGQaLiS4QJax0p356nd+B8x7UQE=')
+ self.assertEqual(str(auth_info.key), PRIVATE_KEY)
+ self.assertEqual(str(auth_info.key.public_key), PUBLIC_KEY)
self.assertEqual(auth_info.agents, [
agent.Agent(url='https://1.example.com/', username='user-1'),
agent.Agent(url='https://2.example.com/discharger', username='user-2'),
@@ -139,12 +142,16 @@ class TestAgents(TestCase):
@urlmatch(path='.*/login')
def login(url, request):
+ qs = parse_qs(urlparse(request.url).query)
+ self.assertEqual(request.method, 'GET')
+ self.assertEqual(
+ qs, {'username': ['test-user'], 'public-key': [PUBLIC_KEY]})
b = bakery.Bakery(key=discharge_key)
m = b.oven.macaroon(
version=bakery.LATEST_VERSION,
expiry=datetime.utcnow() + timedelta(days=1),
caveats=[bakery.local_third_party_caveat(
- auth_info.key.public_key,
+ PUBLIC_KEY,
version=httpbakery.request_version(request.headers))],
ops=[bakery.Op(entity='agent', action='login')])
return {
@@ -164,7 +171,7 @@ class TestAgents(TestCase):
'http://0.1.2.3/here',
cookies=client.cookies,
auth=client.auth())
- self.assertEquals(resp.content, b'done')
+ self.assertEqual(resp.content, b'done')
def test_agent_legacy(self):
discharge_key = bakery.generate_key()
@@ -346,7 +353,7 @@ class TestAgents(TestCase):
cookies=client.cookies,
auth=client.auth(),
)
- self.assertEquals(resp.content, b'done')
+ self.assertEqual(resp.content, b'done')
agent_file = '''
diff --git a/setup.py b/setup.py
index eadbb41..265b5f8 100755
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ from setuptools import (
PROJECT_NAME = 'macaroonbakery'
-VERSION = (1, 1, 0)
+VERSION = (1, 1, 2)
def get_version():