Merge "Fix token issue after auth changeup"
This commit is contained in:
commit
5b7d3ba9dc
@ -159,9 +159,7 @@ class IssueToken(show.ShowOne):
|
|||||||
|
|
||||||
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)
|
||||||
session = self.app.client_manager.identity.session
|
token = self.app.client_manager.auth_ref.service_catalog.get_token()
|
||||||
|
|
||||||
token = session.auth.auth_ref.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')
|
||||||
return zip(*sorted(six.iteritems(token)))
|
return zip(*sorted(six.iteritems(token)))
|
||||||
|
@ -176,10 +176,10 @@ USER = {
|
|||||||
token_expires = '2014-01-01T00:00:00Z'
|
token_expires = '2014-01-01T00:00:00Z'
|
||||||
token_id = 'tttttttt-tttt-tttt-tttt-tttttttttttt'
|
token_id = 'tttttttt-tttt-tttt-tttt-tttttttttttt'
|
||||||
|
|
||||||
TOKEN_WITH_TENANT_ID = {
|
TOKEN_WITH_PROJECT_ID = {
|
||||||
'expires': token_expires,
|
'expires': token_expires,
|
||||||
'id': token_id,
|
'id': token_id,
|
||||||
'tenant_id': project_id,
|
'project_id': project_id,
|
||||||
'user_id': user_id,
|
'user_id': user_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
from openstackclient.identity.v3 import token
|
from openstackclient.identity.v3 import token
|
||||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes
|
from openstackclient.tests.identity.v3 import fakes as identity_fakes
|
||||||
|
|
||||||
@ -23,9 +25,9 @@ class TestToken(identity_fakes.TestIdentityv3):
|
|||||||
super(TestToken, self).setUp()
|
super(TestToken, self).setUp()
|
||||||
|
|
||||||
# Get a shortcut to the Service Catalog Mock
|
# Get a shortcut to the Service Catalog Mock
|
||||||
session = self.app.client_manager.identity.session
|
self.sc_mock = mock.Mock()
|
||||||
self.sc_mock = session.auth.auth_ref.service_catalog
|
self.app.client_manager.auth_ref = mock.Mock()
|
||||||
self.sc_mock.reset_mock()
|
self.app.client_manager.auth_ref.service_catalog = self.sc_mock
|
||||||
|
|
||||||
|
|
||||||
class TestTokenIssue(TestToken):
|
class TestTokenIssue(TestToken):
|
||||||
@ -40,7 +42,7 @@ class TestTokenIssue(TestToken):
|
|||||||
verifylist = []
|
verifylist = []
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
self.sc_mock.get_token.return_value = \
|
self.sc_mock.get_token.return_value = \
|
||||||
identity_fakes.TOKEN_WITH_TENANT_ID
|
identity_fakes.TOKEN_WITH_PROJECT_ID
|
||||||
|
|
||||||
# DisplayCommandBase.take_action() returns two tuples
|
# DisplayCommandBase.take_action() returns two tuples
|
||||||
columns, data = self.cmd.take_action(parsed_args)
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user