Rename token classes to match command
The token create/delete commands were renamed but not the class names. Rename them to match. Change-Id: Icbf9c0a954ed0332fa4c99e4ee2612bb11f89e3a
This commit is contained in:
parent
8f59524c3e
commit
1fca946890
@ -22,30 +22,31 @@ from cliff import command
|
|||||||
from cliff import show
|
from cliff import show
|
||||||
|
|
||||||
|
|
||||||
class CreateToken(show.ShowOne):
|
class IssueToken(show.ShowOne):
|
||||||
"""Issue token command"""
|
"""Issue new token"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.CreateToken')
|
log = logging.getLogger(__name__ + '.IssueToken')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(CreateToken, self).get_parser(prog_name)
|
parser = super(IssueToken, self).get_parser(prog_name)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
token = identity_client.service_catalog.get_token()
|
token = identity_client.service_catalog.get_token()
|
||||||
token['project_id'] = token.pop('tenant_id')
|
token['project_id'] = token.pop('tenant_id')
|
||||||
return zip(*sorted(six.iteritems(token)))
|
return zip(*sorted(six.iteritems(token)))
|
||||||
|
|
||||||
|
|
||||||
class DeleteToken(command.Command):
|
class RevokeToken(command.Command):
|
||||||
"""Revoke token command"""
|
"""Revoke token command"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.DeleteToken')
|
log = logging.getLogger(__name__ + '.RevokeToken')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(DeleteToken, self).get_parser(prog_name)
|
parser = super(RevokeToken, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'token',
|
'token',
|
||||||
metavar='<token>',
|
metavar='<token>',
|
||||||
@ -56,5 +57,6 @@ class DeleteToken(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)' % parsed_args)
|
self.log.debug('take_action(%s)' % parsed_args)
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
identity_client.tokens.delete(parsed_args.token)
|
identity_client.tokens.delete(parsed_args.token)
|
||||||
return
|
return
|
||||||
|
@ -22,7 +22,7 @@ from cliff import show
|
|||||||
|
|
||||||
|
|
||||||
class AuthorizeRequestToken(show.ShowOne):
|
class AuthorizeRequestToken(show.ShowOne):
|
||||||
"""Authorize request token command"""
|
"""Authorize request token"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.AuthorizeRequestToken')
|
log = logging.getLogger(__name__ + '.AuthorizeRequestToken')
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class AuthorizeRequestToken(show.ShowOne):
|
|||||||
|
|
||||||
|
|
||||||
class CreateAccessToken(show.ShowOne):
|
class CreateAccessToken(show.ShowOne):
|
||||||
"""Create access token command"""
|
"""Create access token"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.CreateAccessToken')
|
log = logging.getLogger(__name__ + '.CreateAccessToken')
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ class CreateAccessToken(show.ShowOne):
|
|||||||
|
|
||||||
|
|
||||||
class CreateRequestToken(show.ShowOne):
|
class CreateRequestToken(show.ShowOne):
|
||||||
"""Create request token command"""
|
"""Create request token"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.CreateRequestToken')
|
log = logging.getLogger(__name__ + '.CreateRequestToken')
|
||||||
|
|
||||||
@ -148,18 +148,19 @@ class CreateRequestToken(show.ShowOne):
|
|||||||
return zip(*sorted(six.iteritems(info)))
|
return zip(*sorted(six.iteritems(info)))
|
||||||
|
|
||||||
|
|
||||||
class CreateToken(show.ShowOne):
|
class IssueToken(show.ShowOne):
|
||||||
"""Issue token command"""
|
"""Issue new token"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.CreateToken')
|
log = logging.getLogger(__name__ + '.IssueToken')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(CreateToken, self).get_parser(prog_name)
|
parser = super(IssueToken, self).get_parser(prog_name)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
token = identity_client.service_catalog.get_token()
|
token = identity_client.service_catalog.get_token()
|
||||||
if 'tenant_id' in token:
|
if 'tenant_id' in token:
|
||||||
token['project_id'] = token.pop('tenant_id')
|
token['project_id'] = token.pop('tenant_id')
|
||||||
|
@ -27,15 +27,15 @@ class TestToken(identity_fakes.TestIdentityv2):
|
|||||||
self.sc_mock.reset_mock()
|
self.sc_mock.reset_mock()
|
||||||
|
|
||||||
|
|
||||||
class TestTokenCreate(TestToken):
|
class TestTokenIssue(TestToken):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTokenCreate, self).setUp()
|
super(TestTokenIssue, self).setUp()
|
||||||
|
|
||||||
self.sc_mock.get_token.return_value = identity_fakes.TOKEN
|
self.sc_mock.get_token.return_value = identity_fakes.TOKEN
|
||||||
self.cmd = token.CreateToken(self.app, None)
|
self.cmd = token.IssueToken(self.app, None)
|
||||||
|
|
||||||
def test_token_create(self):
|
def test_token_issue(self):
|
||||||
arglist = []
|
arglist = []
|
||||||
verifylist = []
|
verifylist = []
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -56,18 +56,18 @@ class TestTokenCreate(TestToken):
|
|||||||
self.assertEqual(data, datalist)
|
self.assertEqual(data, datalist)
|
||||||
|
|
||||||
|
|
||||||
class TestTokenDelete(TestToken):
|
class TestTokenRevoke(TestToken):
|
||||||
|
|
||||||
TOKEN = 'fob'
|
TOKEN = 'fob'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTokenDelete, self).setUp()
|
super(TestTokenRevoke, self).setUp()
|
||||||
self.tokens_mock = self.app.client_manager.identity.tokens
|
self.tokens_mock = self.app.client_manager.identity.tokens
|
||||||
self.tokens_mock.reset_mock()
|
self.tokens_mock.reset_mock()
|
||||||
self.tokens_mock.delete.return_value = True
|
self.tokens_mock.delete.return_value = True
|
||||||
self.cmd = token.DeleteToken(self.app, None)
|
self.cmd = token.RevokeToken(self.app, None)
|
||||||
|
|
||||||
def test_token_create(self):
|
def test_token_revoke(self):
|
||||||
arglist = [self.TOKEN]
|
arglist = [self.TOKEN]
|
||||||
verifylist = [('token', self.TOKEN)]
|
verifylist = [('token', self.TOKEN)]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
@ -27,14 +27,14 @@ class TestToken(identity_fakes.TestIdentityv3):
|
|||||||
self.sc_mock.reset_mock()
|
self.sc_mock.reset_mock()
|
||||||
|
|
||||||
|
|
||||||
class TestTokenCreate(TestToken):
|
class TestTokenIssue(TestToken):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTokenCreate, self).setUp()
|
super(TestTokenIssue, self).setUp()
|
||||||
|
|
||||||
self.cmd = token.CreateToken(self.app, None)
|
self.cmd = token.IssueToken(self.app, None)
|
||||||
|
|
||||||
def test_token_create_with_project_id(self):
|
def test_token_issue_with_project_id(self):
|
||||||
arglist = []
|
arglist = []
|
||||||
verifylist = []
|
verifylist = []
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -56,7 +56,7 @@ class TestTokenCreate(TestToken):
|
|||||||
)
|
)
|
||||||
self.assertEqual(data, datalist)
|
self.assertEqual(data, datalist)
|
||||||
|
|
||||||
def test_token_create_with_domain_id(self):
|
def test_token_issue_with_domain_id(self):
|
||||||
arglist = []
|
arglist = []
|
||||||
verifylist = []
|
verifylist = []
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
@ -153,8 +153,8 @@ openstack.identity.v2_0 =
|
|||||||
service_list =openstackclient.identity.v2_0.service:ListService
|
service_list =openstackclient.identity.v2_0.service:ListService
|
||||||
service_show =openstackclient.identity.v2_0.service:ShowService
|
service_show =openstackclient.identity.v2_0.service:ShowService
|
||||||
|
|
||||||
token_issue =openstackclient.identity.v2_0.token:CreateToken
|
token_issue = openstackclient.identity.v2_0.token:IssueToken
|
||||||
token_revoke =openstackclient.identity.v2_0.token:DeleteToken
|
token_revoke = openstackclient.identity.v2_0.token:RevokeToken
|
||||||
|
|
||||||
user_role_list = openstackclient.identity.v2_0.role:ListUserRole
|
user_role_list = openstackclient.identity.v2_0.role:ListUserRole
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ openstack.identity.v3 =
|
|||||||
service_show = openstackclient.identity.v3.service:ShowService
|
service_show = openstackclient.identity.v3.service:ShowService
|
||||||
service_set = openstackclient.identity.v3.service:SetService
|
service_set = openstackclient.identity.v3.service:SetService
|
||||||
|
|
||||||
token_issue = openstackclient.identity.v3.token:CreateToken
|
token_issue = openstackclient.identity.v3.token:IssueToken
|
||||||
|
|
||||||
user_create = openstackclient.identity.v3.user:CreateUser
|
user_create = openstackclient.identity.v3.user:CreateUser
|
||||||
user_delete = openstackclient.identity.v3.user:DeleteUser
|
user_delete = openstackclient.identity.v3.user:DeleteUser
|
||||||
|
Loading…
Reference in New Issue
Block a user