diff options
authorColin Watson <>2018-02-09 21:54:21 +0000
committerColin Watson <>2019-05-09 09:54:14 +0100
commitd31d090af102f64e0dd8266b3d6f28bfb19535c8 (patch)
parent2b249f69fc7344c0579737d76377ccf5abc1043d (diff)
Improve mock setup for 407-then-unknown testarchive/debian/1.2.3-1
`test_407_then_unknown_interaction_methods` causes the client to fetch the possible methods supported by the discharger (because it's told that it only supports a non-window method). This is currently unmocked, which causes the client to actually contact ``. This fails in Launchpad builds because they run with a restrictive network setup that doesn't even expose DNS lookups for non-permitted hosts. There isn't really a good way to simulate this without setting up a similar stunt DNS server (though perhaps installing an `httmock.all_requests` fallback mock that raises an exception would be a good idea?), but this seems to be the only failure at the moment. Forwarded: Last-Update: 2018-02-09 Patch-Name: improve-unknown-interaction-mock.patch Gbp-Pq: Name improve-unknown-interaction-mock.patch
1 files changed, 12 insertions, 1 deletions
diff --git a/macaroonbakery/tests/ b/macaroonbakery/tests/
index 72a6928..1883987 100644
--- a/macaroonbakery/tests/
+++ b/macaroonbakery/tests/
@@ -146,6 +146,16 @@ def discharge_401(url, request):
+def visit_200(url, request):
+ return {
+ 'status_code': 200,
+ 'content': {
+ 'interactive': '/visit'
+ }
+ }
def wait_after_401(url, request):
if request.url != '':
@@ -245,7 +255,8 @@ class TestBakery(TestCase):
def kind(self):
return 'unknown'
client = httpbakery.Client(interaction_methods=[UnknownInteractor()])
- with HTTMock(first_407_then_200), HTTMock(discharge_401):
+ with HTTMock(first_407_then_200), HTTMock(discharge_401),\
+ HTTMock(visit_200):
with self.assertRaises(httpbakery.InteractionError) as exc: