Merge "Fix missed management_url setter in v3 client"

This commit is contained in:
Jenkins
2013-12-28 03:47:22 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 8 deletions

View File

@@ -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

View File

@@ -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