Fix Keystone.fetch_token method
While removeing deprecated api_info argument of osclients.Client, we forgot to clean one place. This patch fixes it Change-Id: Ib69f249ac812b6dfeedfa58444adbc05592e95a9
This commit is contained in:
parent
3605bc7e99
commit
107703dd16
@ -1,5 +1,16 @@
|
||||
{%- set cirros_image_url = "https://github.com/cirros-dev/cirros/releases/download/0.3.5/cirros-0.3.5-x86_64-disk.img" %}
|
||||
---
|
||||
KeystoneBasic.authenticate_user_and_validate_token:
|
||||
-
|
||||
args: {}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 20
|
||||
concurrency: 5
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
KeystoneBasic.create_user:
|
||||
-
|
||||
args: {}
|
||||
|
@ -176,11 +176,11 @@ class KeystoneMixin(object):
|
||||
|
||||
def fetch_token(self):
|
||||
"""Authenticate user token."""
|
||||
cred = self._clients.credential
|
||||
aname = "keystone_v%s.fetch_token" % self.version
|
||||
with atomic.ActionTimer(self, aname):
|
||||
clients = osclients.Clients(credential=cred,
|
||||
api_info=self._clients.api_info)
|
||||
# use another instance of osclients.Clients to avoid usage of
|
||||
# cached keystone session
|
||||
clients = osclients.Clients(credential=self._clients.credential)
|
||||
return clients.keystone.auth_ref.auth_token
|
||||
|
||||
def validate_token(self, token):
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from rally_openstack.common import osclients
|
||||
from rally_openstack.common import service
|
||||
from rally_openstack.common.services.identity import identity
|
||||
from rally_openstack.common.services.identity import keystone_common
|
||||
@ -265,13 +266,14 @@ class KeystoneMixinTestCase(test.TestCase):
|
||||
self.kc.ec2.delete.assert_called_once_with(user_id=user_id,
|
||||
access=access)
|
||||
|
||||
@mock.patch("rally_openstack.common.osclients.Clients")
|
||||
@mock.patch("rally_openstack.common.osclients.Clients",
|
||||
spec=osclients.Clients)
|
||||
def test_fetch_token(self, mock_clients):
|
||||
mock_clients.return_value = mock.Mock(keystone=mock.Mock())
|
||||
expected_token = mock_clients.return_value.keystone.auth_ref.auth_token
|
||||
self.assertEqual(expected_token, self.service.fetch_token())
|
||||
mock_clients.assert_called_once_with(
|
||||
credential=self.clients.credential,
|
||||
api_info=self.clients.api_info)
|
||||
credential=self.clients.credential)
|
||||
|
||||
def test_validate_token(self):
|
||||
token = "some_token"
|
||||
|
Loading…
x
Reference in New Issue
Block a user