diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py index fe1557a59b..01e1b3b26a 100644 --- a/openstackclient/identity/v2_0/token.py +++ b/openstackclient/identity/v2_0/token.py @@ -22,30 +22,31 @@ from cliff import command from cliff import show -class CreateToken(show.ShowOne): - """Issue token command""" +class IssueToken(show.ShowOne): + """Issue new token""" - log = logging.getLogger(__name__ + '.CreateToken') + log = logging.getLogger(__name__ + '.IssueToken') def get_parser(self, prog_name): - parser = super(CreateToken, self).get_parser(prog_name) + parser = super(IssueToken, self).get_parser(prog_name) return parser def take_action(self, parsed_args): self.log.debug('take_action(%s)', parsed_args) identity_client = self.app.client_manager.identity + token = identity_client.service_catalog.get_token() token['project_id'] = token.pop('tenant_id') return zip(*sorted(six.iteritems(token))) -class DeleteToken(command.Command): +class RevokeToken(command.Command): """Revoke token command""" - log = logging.getLogger(__name__ + '.DeleteToken') + log = logging.getLogger(__name__ + '.RevokeToken') 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( 'token', metavar='', @@ -56,5 +57,6 @@ class DeleteToken(command.Command): def take_action(self, parsed_args): self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity + identity_client.tokens.delete(parsed_args.token) return diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py index cd73d03a2f..52ed439f15 100644 --- a/openstackclient/identity/v3/token.py +++ b/openstackclient/identity/v3/token.py @@ -22,7 +22,7 @@ from cliff import show class AuthorizeRequestToken(show.ShowOne): - """Authorize request token command""" + """Authorize request token""" log = logging.getLogger(__name__ + '.AuthorizeRequestToken') @@ -59,7 +59,7 @@ class AuthorizeRequestToken(show.ShowOne): class CreateAccessToken(show.ShowOne): - """Create access token command""" + """Create access token""" log = logging.getLogger(__name__ + '.CreateAccessToken') @@ -110,7 +110,7 @@ class CreateAccessToken(show.ShowOne): class CreateRequestToken(show.ShowOne): - """Create request token command""" + """Create request token""" log = logging.getLogger(__name__ + '.CreateRequestToken') @@ -148,18 +148,19 @@ class CreateRequestToken(show.ShowOne): return zip(*sorted(six.iteritems(info))) -class CreateToken(show.ShowOne): - """Issue token command""" +class IssueToken(show.ShowOne): + """Issue new token""" - log = logging.getLogger(__name__ + '.CreateToken') + log = logging.getLogger(__name__ + '.IssueToken') def get_parser(self, prog_name): - parser = super(CreateToken, self).get_parser(prog_name) + parser = super(IssueToken, self).get_parser(prog_name) return parser def take_action(self, parsed_args): self.log.debug('take_action(%s)', parsed_args) identity_client = self.app.client_manager.identity + token = identity_client.service_catalog.get_token() if 'tenant_id' in token: token['project_id'] = token.pop('tenant_id') diff --git a/openstackclient/tests/identity/v2_0/test_token.py b/openstackclient/tests/identity/v2_0/test_token.py index e1967537b2..e094ad4ab7 100644 --- a/openstackclient/tests/identity/v2_0/test_token.py +++ b/openstackclient/tests/identity/v2_0/test_token.py @@ -27,15 +27,15 @@ class TestToken(identity_fakes.TestIdentityv2): self.sc_mock.reset_mock() -class TestTokenCreate(TestToken): +class TestTokenIssue(TestToken): def setUp(self): - super(TestTokenCreate, self).setUp() + super(TestTokenIssue, self).setUp() 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 = [] verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -56,18 +56,18 @@ class TestTokenCreate(TestToken): self.assertEqual(data, datalist) -class TestTokenDelete(TestToken): +class TestTokenRevoke(TestToken): TOKEN = 'fob' def setUp(self): - super(TestTokenDelete, self).setUp() + super(TestTokenRevoke, self).setUp() self.tokens_mock = self.app.client_manager.identity.tokens self.tokens_mock.reset_mock() 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] verifylist = [('token', self.TOKEN)] parsed_args = self.check_parser(self.cmd, arglist, verifylist) diff --git a/openstackclient/tests/identity/v3/test_token.py b/openstackclient/tests/identity/v3/test_token.py index 7e1d1669b9..8888b93186 100644 --- a/openstackclient/tests/identity/v3/test_token.py +++ b/openstackclient/tests/identity/v3/test_token.py @@ -27,14 +27,14 @@ class TestToken(identity_fakes.TestIdentityv3): self.sc_mock.reset_mock() -class TestTokenCreate(TestToken): +class TestTokenIssue(TestToken): 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 = [] verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -56,7 +56,7 @@ class TestTokenCreate(TestToken): ) self.assertEqual(data, datalist) - def test_token_create_with_domain_id(self): + def test_token_issue_with_domain_id(self): arglist = [] verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) diff --git a/setup.cfg b/setup.cfg index 8e4e414303..4c56104734 100644 --- a/setup.cfg +++ b/setup.cfg @@ -153,8 +153,8 @@ openstack.identity.v2_0 = service_list =openstackclient.identity.v2_0.service:ListService service_show =openstackclient.identity.v2_0.service:ShowService - token_issue =openstackclient.identity.v2_0.token:CreateToken - token_revoke =openstackclient.identity.v2_0.token:DeleteToken + token_issue = openstackclient.identity.v2_0.token:IssueToken + token_revoke = openstackclient.identity.v2_0.token:RevokeToken user_role_list = openstackclient.identity.v2_0.role:ListUserRole @@ -236,7 +236,7 @@ openstack.identity.v3 = service_show = openstackclient.identity.v3.service:ShowService 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_delete = openstackclient.identity.v3.user:DeleteUser