Fix issue token for v3
Currently the code is broken as it references a part of keystoneclient that does not exist. Change-Id: I7fbc754537fbb4acffb166b5854840acfaef1fb8 Closes-Bug: #1379871
This commit is contained in:
parent
0c77a9fe8b
commit
1b3c7ec122
@ -76,6 +76,7 @@ class IdentityV3Tests(test.TestCase):
|
||||
|
||||
DOMAIN_FIELDS = ['description', 'enabled', 'id', 'name', 'links']
|
||||
GROUP_FIELDS = ['description', 'domain_id', 'id', 'name', 'links']
|
||||
TOKEN_FIELDS = ['expires', 'id', 'project_id', 'user_id']
|
||||
|
||||
def _create_dummy_group(self):
|
||||
name = uuid.uuid4().hex
|
||||
@ -139,3 +140,8 @@ class IdentityV3Tests(test.TestCase):
|
||||
raw_output = self.openstack('domain show ' + name)
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.DOMAIN_FIELDS)
|
||||
|
||||
def test_token_issue(self):
|
||||
raw_output = self.openstack('token issue')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.TOKEN_FIELDS)
|
||||
|
@ -159,9 +159,9 @@ class IssueToken(show.ShowOne):
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
session = self.app.client_manager.identity.session
|
||||
|
||||
token = identity_client.service_catalog.get_token()
|
||||
token = session.auth.auth_ref.service_catalog.get_token()
|
||||
if 'tenant_id' in token:
|
||||
token['project_id'] = token.pop('tenant_id')
|
||||
return zip(*sorted(six.iteritems(token)))
|
||||
|
@ -292,7 +292,9 @@ class FakeIdentityv3Client(object):
|
||||
self.roles.resource_class = fakes.FakeResource(None, {})
|
||||
self.services = mock.Mock()
|
||||
self.services.resource_class = fakes.FakeResource(None, {})
|
||||
self.service_catalog = mock.Mock()
|
||||
self.session = mock.Mock()
|
||||
self.session.auth.auth_ref.service_catalog.resource_class = \
|
||||
fakes.FakeResource(None, {})
|
||||
self.users = mock.Mock()
|
||||
self.users.resource_class = fakes.FakeResource(None, {})
|
||||
self.role_assignments = mock.Mock()
|
||||
|
@ -23,7 +23,8 @@ class TestToken(identity_fakes.TestIdentityv3):
|
||||
super(TestToken, self).setUp()
|
||||
|
||||
# Get a shortcut to the Service Catalog Mock
|
||||
self.sc_mock = self.app.client_manager.identity.service_catalog
|
||||
session = self.app.client_manager.identity.session
|
||||
self.sc_mock = session.auth.auth_ref.service_catalog
|
||||
self.sc_mock.reset_mock()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user