Use Keystone V3 Identity Plugins for Functional Tests
Changes the way keystone authentication is being accessed in Functional Tests. Change-Id: I32c938f1a353d1704b5bc30fd40c7eb5f2ae708d
This commit is contained in:
parent
1810e005b3
commit
a4e7f52a8b
@ -21,7 +21,7 @@ TEST_CONF = None
|
||||
|
||||
identity_group = cfg.OptGroup(name='identity')
|
||||
identity_options = [
|
||||
cfg.StrOpt('uri',
|
||||
cfg.StrOpt('auth_url',
|
||||
default='http://localhost:5000/v3',
|
||||
help='Keystone endpoint'),
|
||||
cfg.StrOpt('username',
|
||||
@ -32,7 +32,13 @@ identity_options = [
|
||||
help='Password used with Keystone username'),
|
||||
cfg.StrOpt('project_name',
|
||||
default='admin',
|
||||
help='Name of project, used by the given username')]
|
||||
help='Name of project, used by the given username'),
|
||||
cfg.StrOpt('user_domain_name',
|
||||
default='Default',
|
||||
help='Name of domain, used by the given username'),
|
||||
cfg.StrOpt('project_domain_name',
|
||||
default='Default',
|
||||
help='Name of domain, used by the given project')]
|
||||
|
||||
|
||||
def setup_config(config_file=''):
|
||||
|
@ -21,6 +21,8 @@ Note: This requires local running instances of Barbican and Keystone.
|
||||
|
||||
import uuid
|
||||
|
||||
from keystoneclient.auth.identity import v3
|
||||
from keystoneclient import session
|
||||
from keystoneclient.v3 import client
|
||||
from oslo_config import cfg
|
||||
from oslo_context import context
|
||||
@ -46,16 +48,23 @@ class BarbicanKeyManagerTestCase(test_key_manager.KeyManagerTestCase,
|
||||
username = CONF.identity.username
|
||||
password = CONF.identity.password
|
||||
project_name = CONF.identity.project_name
|
||||
auth_url = CONF.identity.uri
|
||||
keystone_client = client.Client(username=username,
|
||||
password=password,
|
||||
project_name=project_name,
|
||||
auth_url=auth_url,
|
||||
project_domain_id='default')
|
||||
auth_url = CONF.identity.auth_url
|
||||
user_domain_name = CONF.identity.user_domain_name
|
||||
project_domain_name = CONF.identity.project_domain_name
|
||||
|
||||
auth = v3.Password(auth_url=auth_url,
|
||||
username=username,
|
||||
password=password,
|
||||
project_name=project_name,
|
||||
user_domain_name=user_domain_name,
|
||||
project_domain_name=project_domain_name)
|
||||
sess = session.Session(auth=auth)
|
||||
keystone_client = client.Client(session=sess)
|
||||
|
||||
project_list = keystone_client.projects.list(name=project_name)
|
||||
|
||||
self.ctxt = context.RequestContext(
|
||||
auth_token=keystone_client.auth_token,
|
||||
auth_token=auth.auth_ref.auth_token,
|
||||
tenant=project_list[0].id)
|
||||
|
||||
def tearDown(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user