Codebase list python-castellan / a4e7f52
Use Keystone V3 Identity Plugins for Functional Tests Changes the way keystone authentication is being accessed in Functional Tests. Change-Id: I32c938f1a353d1704b5bc30fd40c7eb5f2ae708d “Fernando authored 8 years ago Fernando Diaz committed 8 years ago
2 changed file(s) with 24 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2020
2121 identity_group = cfg.OptGroup(name='identity')
2222 identity_options = [
23 cfg.StrOpt('uri',
23 cfg.StrOpt('auth_url',
2424 default='http://localhost:5000/v3',
2525 help='Keystone endpoint'),
2626 cfg.StrOpt('username',
3131 help='Password used with Keystone username'),
3232 cfg.StrOpt('project_name',
3333 default='admin',
34 help='Name of project, used by the given username')]
34 help='Name of project, used by the given username'),
35 cfg.StrOpt('user_domain_name',
36 default='Default',
37 help='Name of domain, used by the given username'),
38 cfg.StrOpt('project_domain_name',
39 default='Default',
40 help='Name of domain, used by the given project')]
3541
3642
3743 def setup_config(config_file=''):
2020
2121 import uuid
2222
23 from keystoneclient.auth.identity import v3
24 from keystoneclient import session
2325 from keystoneclient.v3 import client
2426 from oslo_config import cfg
2527 from oslo_context import context
4547 username = CONF.identity.username
4648 password = CONF.identity.password
4749 project_name = CONF.identity.project_name
48 auth_url = CONF.identity.uri
49 keystone_client = client.Client(username=username,
50 password=password,
51 project_name=project_name,
52 auth_url=auth_url,
53 project_domain_id='default')
50 auth_url = CONF.identity.auth_url
51 user_domain_name = CONF.identity.user_domain_name
52 project_domain_name = CONF.identity.project_domain_name
53
54 auth = v3.Password(auth_url=auth_url,
55 username=username,
56 password=password,
57 project_name=project_name,
58 user_domain_name=user_domain_name,
59 project_domain_name=project_domain_name)
60 sess = session.Session(auth=auth)
61 keystone_client = client.Client(session=sess)
62
5463 project_list = keystone_client.projects.list(name=project_name)
5564
5665 self.ctxt = context.RequestContext(
57 auth_token=keystone_client.auth_token,
66 auth_token=auth.auth_ref.auth_token,
5867 tenant=project_list[0].id)
5968
6069 def tearDown(self):