diff options
Diffstat (limited to 'keystoneclient')
-rw-r--r-- | keystoneclient/discover.py | 14 | ||||
-rw-r--r-- | keystoneclient/httpclient.py | 19 | ||||
-rw-r--r-- | keystoneclient/tests/unit/test_session.py | 2 | ||||
-rw-r--r-- | keystoneclient/tests/unit/test_utils.py | 2 | ||||
-rw-r--r-- | keystoneclient/tests/unit/v3/test_auth.py | 4 | ||||
-rw-r--r-- | keystoneclient/tests/unit/v3/utils.py | 1 |
6 files changed, 26 insertions, 16 deletions
diff --git a/keystoneclient/discover.py b/keystoneclient/discover.py index 0c129b3..1617416 100644 --- a/keystoneclient/discover.py +++ b/keystoneclient/discover.py @@ -232,8 +232,8 @@ class Discover(_discover.Discover): >>> disc = discover.Discovery(auth_url='http://localhost:5000') >>> disc.raw_version_data() [{'id': 'v3.0', - 'links': [{'href': u'http://127.0.0.1:5000/v3/', - 'rel': u'self'}], + 'links': [{'href': 'http://127.0.0.1:5000/v3/', + 'rel': 'self'}], 'media-types': [ {'base': 'application/json', 'type': 'application/vnd.openstack.identity-v3+json'}, @@ -242,11 +242,11 @@ class Discover(_discover.Discover): 'status': 'stable', 'updated': '2013-03-06T00:00:00Z'}, {'id': 'v2.0', - 'links': [{'href': u'http://127.0.0.1:5000/v2.0/', - 'rel': u'self'}, - {'href': u'...', - 'rel': u'describedby', - 'type': u'application/pdf'}], + 'links': [{'href': 'http://127.0.0.1:5000/v2.0/', + 'rel': 'self'}, + {'href': '...', + 'rel': 'describedby', + 'type': 'application/pdf'}], 'media-types': [ {'base': 'application/json', 'type': 'application/vnd.openstack.identity-v2.0+json'}, diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py index 8d157ce..1e94dab 100644 --- a/keystoneclient/httpclient.py +++ b/keystoneclient/httpclient.py @@ -221,7 +221,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin): :param string service_name: The default service_name for URL discovery. default: None (optional) :param string interface: The default interface for URL discovery. - default: admin (optional) + default: admin (v2), public (v3). (optional) :param string endpoint_override: Always use this endpoint URL for requests for this client. (optional) :param auth: An auth plugin to use instead of the session one. (optional) @@ -248,7 +248,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin): domain_name=None, project_id=None, project_name=None, project_domain_id=None, project_domain_name=None, trust_id=None, session=None, service_name=None, - interface='admin', endpoint_override=None, auth=None, + interface='default', endpoint_override=None, auth=None, user_agent=USER_AGENT, connect_retries=None, **kwargs): # set baseline defaults self.user_id = None @@ -372,12 +372,21 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin): self.session = session self.domain = '' - # NOTE(jamielennox): unfortunately we can't just use **kwargs here as - # it would incompatibly limit the kwargs that can be passed to __init__ - # try and keep this list in sync with adapter.Adapter.__init__ version = ( _discover.normalize_version_number(self.version) if self.version else None) + + # NOTE(frickler): If we know we have v3, use the public interface as + # default, otherwise keep the historic default of admin + if interface == 'default': + if version == (3, 0): + interface = 'public' + else: + interface = 'admin' + + # NOTE(jamielennox): unfortunately we can't just use **kwargs here as + # it would incompatibly limit the kwargs that can be passed to __init__ + # try and keep this list in sync with adapter.Adapter.__init__ self._adapter = _KeystoneAdapter(session, service_type='identity', service_name=service_name, diff --git a/keystoneclient/tests/unit/test_session.py b/keystoneclient/tests/unit/test_session.py index 14cfe31..f201a0b 100644 --- a/keystoneclient/tests/unit/test_session.py +++ b/keystoneclient/tests/unit/test_session.py @@ -243,7 +243,7 @@ class SessionTests(utils.TestCase): session = client_session.Session(verify=False) body = 'RESP' - data = u'αβγδ' + data = 'αβγδ' self.stub_url('POST', text=body) session.post(self.TEST_URL, data=data) diff --git a/keystoneclient/tests/unit/test_utils.py b/keystoneclient/tests/unit/test_utils.py index 0144331..c1f6f8c 100644 --- a/keystoneclient/tests/unit/test_utils.py +++ b/keystoneclient/tests/unit/test_utils.py @@ -33,7 +33,7 @@ class FakeManager(object): resources = { '1234': {'name': 'entity_one'}, '8e8ec658-c7b0-4243-bdf8-6f7f2952c0d0': {'name': 'entity_two'}, - '\xe3\x82\xbdtest': {'name': u'\u30bdtest'}, + '\xe3\x82\xbdtest': {'name': '\u30bdtest'}, '5678': {'name': '9876'} } diff --git a/keystoneclient/tests/unit/v3/test_auth.py b/keystoneclient/tests/unit/v3/test_auth.py index 9f87977..d3c44ad 100644 --- a/keystoneclient/tests/unit/v3/test_auth.py +++ b/keystoneclient/tests/unit/v3/test_auth.py @@ -232,7 +232,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): self.stub_auth(json=self.TEST_RESPONSE_DICT) self.stub_url('GET', [fake_url], json=fake_resp, - base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT) + base_url=self.TEST_PUBLIC_IDENTITY_ENDPOINT) # Creating a HTTPClient not using session is deprecated. with self.deprecations.expect_deprecations_here(): @@ -335,7 +335,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): self.stub_auth(json=self.TEST_RESPONSE_DICT) self.stub_url('GET', [fake_url], json=fake_resp, - base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT) + base_url=self.TEST_PUBLIC_IDENTITY_ENDPOINT) # Creating a HTTPClient not using session is deprecated. with self.deprecations.expect_deprecations_here(): diff --git a/keystoneclient/tests/unit/v3/utils.py b/keystoneclient/tests/unit/v3/utils.py index 22430fa..e7d8b8d 100644 --- a/keystoneclient/tests/unit/v3/utils.py +++ b/keystoneclient/tests/unit/v3/utils.py @@ -48,6 +48,7 @@ class UnauthenticatedTestCase(utils.TestCase): class TestCase(UnauthenticatedTestCase): TEST_ADMIN_IDENTITY_ENDPOINT = "http://127.0.0.1:35357/v3" + TEST_PUBLIC_IDENTITY_ENDPOINT = "http://127.0.0.1:5000/v3" TEST_SERVICE_CATALOG = [{ "endpoints": [{ |