Merge "Fix missing service_catalog parameter in Client object"
This commit is contained in:
@@ -442,7 +442,10 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
||||
@property
|
||||
def service_catalog(self):
|
||||
"""Return this client's service catalog."""
|
||||
return self.auth_ref.service_catalog
|
||||
try:
|
||||
return self.auth_ref.service_catalog
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
def has_service_catalog(self):
|
||||
"""Return True if this client provides a service catalog."""
|
||||
|
@@ -16,6 +16,7 @@ import uuid
|
||||
from keystoneauth1 import fixture
|
||||
import six
|
||||
|
||||
from keystoneauth1 import session as auth_session
|
||||
from keystoneclient.auth import token_endpoint
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient import session
|
||||
@@ -211,3 +212,10 @@ class KeystoneClientTest(utils.TestCase):
|
||||
|
||||
self.assertEqual('identity', cl._adapter.service_type)
|
||||
self.assertEqual((2, 0), cl._adapter.version)
|
||||
|
||||
def test_empty_service_catalog_param(self):
|
||||
# Client().service_catalog should return None if the client is not
|
||||
# authenticated
|
||||
sess = auth_session.Session()
|
||||
cl = client.Client(session=sess)
|
||||
self.assertEqual(None, cl.service_catalog)
|
||||
|
@@ -16,6 +16,7 @@ import uuid
|
||||
|
||||
import six
|
||||
|
||||
from keystoneauth1 import session as auth_session
|
||||
from keystoneclient.auth import token_endpoint
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient import session
|
||||
@@ -261,3 +262,10 @@ class KeystoneClientTest(utils.TestCase):
|
||||
|
||||
self.assertEqual('identity', cl._adapter.service_type)
|
||||
self.assertEqual((3, 0), cl._adapter.version)
|
||||
|
||||
def test_empty_service_catalog_param(self):
|
||||
# Client().service_catalog should return None if the client is not
|
||||
# authenticated
|
||||
sess = auth_session.Session()
|
||||
cl = client.Client(session=sess)
|
||||
self.assertEqual(None, cl.service_catalog)
|
||||
|
Reference in New Issue
Block a user