Fix missed management_url setter in v3 client
Setting management_url is intended to mean that this is an overriding URL not one received from the service catalog. This was fixed for project scoped tokens but was missed from domain scoped tokens. Change-Id: I8484f4a26a5695ef7ae962918ad442fe20bd2caa Related Change: I2fa41e2ae1b853bbb254698cf94b9314eb0f0903 Related-Bug: #1252927
This commit is contained in:
@@ -136,9 +136,8 @@ class KeystoneClientTest(utils.TestCase):
|
||||
username='exampleuser',
|
||||
password='password')
|
||||
|
||||
@httpretty.activate
|
||||
def test_management_url_is_updated(self):
|
||||
second = copy.deepcopy(client_fixtures.PROJECT_SCOPED_TOKEN)
|
||||
def _management_url_is_updated(self, fixture, **kwargs):
|
||||
second = copy.deepcopy(fixture)
|
||||
first_url = 'http://admin:35357/v3'
|
||||
second_url = "http://secondurl:%d/v3'"
|
||||
|
||||
@@ -158,11 +157,11 @@ class KeystoneClientTest(utils.TestCase):
|
||||
'interface': 'admin'
|
||||
}]
|
||||
|
||||
self.stub_auth(json=client_fixtures.PROJECT_SCOPED_TOKEN)
|
||||
self.stub_auth(json=fixture)
|
||||
cl = client.Client(username='exampleuser',
|
||||
password='password',
|
||||
tenant_name='exampleproject',
|
||||
auth_url=self.TEST_URL)
|
||||
auth_url=self.TEST_URL,
|
||||
**kwargs)
|
||||
|
||||
self.assertEqual(cl.management_url, first_url)
|
||||
|
||||
@@ -170,6 +169,16 @@ class KeystoneClientTest(utils.TestCase):
|
||||
cl.authenticate()
|
||||
self.assertEqual(cl.management_url, second_url % 35357)
|
||||
|
||||
@httpretty.activate
|
||||
def test_management_url_is_updated_with_project(self):
|
||||
self._management_url_is_updated(client_fixtures.PROJECT_SCOPED_TOKEN,
|
||||
project_name='exampleproject')
|
||||
|
||||
@httpretty.activate
|
||||
def test_management_url_is_updated_with_domain(self):
|
||||
self._management_url_is_updated(client_fixtures.DOMAIN_SCOPED_TOKEN,
|
||||
domain_name='exampledomain')
|
||||
|
||||
@httpretty.activate
|
||||
def test_client_with_region_name_passes_to_service_catalog(self):
|
||||
# NOTE(jamielennox): this is deprecated behaviour that should be
|
||||
|
@@ -117,8 +117,8 @@ class Client(httpclient.HTTPClient):
|
||||
if not self.auth_ref.domain_id:
|
||||
raise exceptions.AuthorizationFailure(
|
||||
"Token didn't provide domain_id")
|
||||
if self.management_url is None and self.auth_ref.management_url:
|
||||
self.management_url = self.auth_ref.management_url[0]
|
||||
if self.auth_ref.management_url:
|
||||
self._management_url = self.auth_ref.management_url[0]
|
||||
self.domain_name = self.auth_ref.domain_name
|
||||
self.domain_id = self.auth_ref.domain_id
|
||||
|
||||
|
Reference in New Issue
Block a user