From 1b519535f79db490069a242cc591cfd75d2e7394 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Wed, 30 Apr 2014 11:58:17 +1000 Subject: [PATCH] Add endpoint handling to Token/Endpoint auth This auth plugin was initially created before get_endpoint was available. Implement the get_endpoint method so that we can use the plugin with relative URLs. Closes-Bug: #1323926 Change-Id: Ic868f509e708ad29faf86ec5ceeab2a9c98a24fc --- auth/test_token_endpoint.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/auth/test_token_endpoint.py b/auth/test_token_endpoint.py index 5955425..c59e17e 100644 --- a/auth/test_token_endpoint.py +++ b/auth/test_token_endpoint.py @@ -33,3 +33,17 @@ class TokenEndpointTest(utils.TestCase): self.assertEqual(data.text, 'body') self.assertRequestHeaderEqual('X-Auth-Token', self.TEST_TOKEN) + + @httpretty.activate + def test_basic_endpoint_case(self): + self.stub_url(httpretty.GET, ['p'], body='body') + a = token_endpoint.Token(self.TEST_URL, self.TEST_TOKEN) + s = session.Session(auth=a) + + data = s.get('/p', + authenticated=True, + endpoint_filter={'service': 'identity'}) + + self.assertEqual(self.TEST_URL, a.get_endpoint(s)) + self.assertEqual('body', data.text) + self.assertRequestHeaderEqual('X-Auth-Token', self.TEST_TOKEN)