Merge "Prevent AttributeError if no authorization"

This commit is contained in:
Jenkins
2014-10-27 00:20:37 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 1 deletions

View File

@@ -312,7 +312,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
def has_service_catalog(self):
"""Returns True if this client provides a service catalog."""
return self.auth_ref.has_service_catalog()
return self.auth_ref and self.auth_ref.has_service_catalog()
@property
def tenant_id(self):

View File

@@ -33,6 +33,7 @@ class KeystoneClientTest(utils.TestCase):
self.assertFalse(c.auth_ref.project_scoped)
self.assertEqual(c.auth_user_id,
'c4da488862bd435c9e6c0275a0d0e49a')
self.assertFalse(c.has_service_catalog())
def test_domain_scoped_init(self):
self.stub_auth(json=client_fixtures.domain_scoped_token())