diff --git a/keystoneclient/auth/token_endpoint.py b/keystoneclient/auth/token_endpoint.py index 27d96734b..2245af709 100644 --- a/keystoneclient/auth/token_endpoint.py +++ b/keystoneclient/auth/token_endpoint.py @@ -29,3 +29,11 @@ class Token(base.BaseAuthPlugin): def get_token(self, session): return self.token + + def get_endpoint(self, session, **kwargs): + """Return the supplied endpoint. + + Using this plugin the same endpoint is returned regardless of the + parameters passed to the plugin. + """ + return self.endpoint diff --git a/keystoneclient/tests/auth/test_token_endpoint.py b/keystoneclient/tests/auth/test_token_endpoint.py index 59554251c..c59e17e1c 100644 --- a/keystoneclient/tests/auth/test_token_endpoint.py +++ b/keystoneclient/tests/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)