summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/common/test_keystone.py
diff options
context:
space:
mode:
authorPavlo Shchelokovskyy <shchelokovskyy@gmail.com>2017-06-06 14:15:42 +0000
committerJulia Kreger <juliaashleykreger@gmail.com>2017-11-17 11:40:14 -0500
commit63e0ff2f6ce3a8275c262127e046fffbb1f1ff65 (patch)
tree9d4de497784c9a0c4ed5595afcb02b0eb0f248bb /ironic/tests/unit/common/test_keystone.py
parent50c42e57db26a1de7e97740b5a9f7dc3e3474478 (diff)
downloadironic-63e0ff2f6ce3a8275c262127e046fffbb1f1ff65.tar.gz
Rework keystone auth for glance
this patch changes the way glance client is instantiated, using keystoneauth sessions and adapters. In order to support glance API endpoint discovery from keystone catalog and more unified way of client loading, many options in `[glance]` config sections are deprecated, mostly those that specified a (set of) glance API endpoint(s) or parts of glance API address. Instead, a single option `[glance]endpoint_override` must be used when required to access a specific (possibly load-balanced) glance API endpoint without discovering it from keystone catalog. Another set of deprecated options are those that are duplicating keystoneauth session options in [glance] section. Also, intrinsic support for parsing the glance API URL from image ref set to the full glance REST path to the image is removed as it was not working any way since an 'http(s)://' image ref is not treated as a glance image. Change-Id: I6a93b71ac097e951dfc93fd1ee4d7ef483514f2c Partial-Bug: #1699547 Closes-Bug: #1699542
Diffstat (limited to 'ironic/tests/unit/common/test_keystone.py')
-rw-r--r--ironic/tests/unit/common/test_keystone.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ironic/tests/unit/common/test_keystone.py b/ironic/tests/unit/common/test_keystone.py
index 31c85baad..9babe028c 100644
--- a/ironic/tests/unit/common/test_keystone.py
+++ b/ironic/tests/unit/common/test_keystone.py
@@ -17,6 +17,7 @@ import mock
from oslo_config import cfg
from oslo_config import fixture
+from ironic.common import context
from ironic.common import exception
from ironic.common import keystone
from ironic.conf import auth as ironic_auth
@@ -92,3 +93,14 @@ class KeystoneTestCase(base.TestCase):
interface='admin')
self.assertEqual('admin', adapter.interface)
self.assertEqual(session, adapter.session)
+
+ @mock.patch('keystoneauth1.service_token.ServiceTokenAuthWrapper')
+ @mock.patch('keystoneauth1.token_endpoint.Token')
+ def test_get_service_auth(self, token_mock, service_auth_mock):
+ ctxt = context.RequestContext(auth_token='spam')
+ mock_auth = mock.Mock()
+ self.assertEqual(service_auth_mock.return_value,
+ keystone.get_service_auth(ctxt, 'ham', mock_auth))
+ token_mock.assert_called_once_with('ham', 'spam')
+ service_auth_mock.assert_called_once_with(
+ user_auth=token_mock.return_value, service_auth=mock_auth)