get_endpoint should return the override

If your adapter has an endpoint_override set then this value will be
consumed by session and used in preference to whatever you give to
endpoint_filter.

This means that if you ask the adapter for the endpoint it is going to
use to query a URL you expect to get back the override because this is
where it will be sent.

Closes-Bug: #1400174
Change-Id: I707e549a4fa349d0e9a0bdac61a2573aa2e5b434
This commit is contained in:
Jamie Lennox
2014-10-28 13:25:18 +01:00
parent 28ea0a8e36
commit 6b0fd667ce
2 changed files with 5 additions and 0 deletions

View File

@@ -116,6 +116,9 @@ class Adapter(object):
:returns: An endpoint if available or None.
:rtype: string
"""
if self.endpoint_override:
return self.endpoint_override
self._set_endpoint_filter_kwargs(kwargs)
return self.session.get_endpoint(auth or self.auth, **kwargs)

View File

@@ -689,6 +689,8 @@ class AdapterTest(utils.TestCase):
self.assertEqual(response, resp.text)
self.assertEqual(endpoint_url, self.requests.last_request.url)
self.assertEqual(endpoint_override, adpt.get_endpoint())
def test_adapter_invalidate(self):
auth = CalledAuthPlugin()
sess = client_session.Session()