Merge "Fix cleanup manager with api_versions context"

This commit is contained in:
Jenkins 2016-02-18 19:24:20 +00:00 committed by Gerrit Code Review
commit b1edf3b995
2 changed files with 4 additions and 7 deletions

View File

@ -59,7 +59,8 @@ class SeekAndDestroy(object):
else:
key = user["credential"]
if key not in cache:
cache[key] = osclients.Clients(key, api_info=api_versions)
cache[key] = osclients.Clients(user["credential"],
api_info=api_versions)
return cache[key]

View File

@ -26,9 +26,7 @@ BASE = "rally.plugins.openstack.cleanup.manager"
class SeekAndDestroyTestCase(test.TestCase):
@mock.patch("%s.osclients.Clients" % BASE,
side_effect=[mock.MagicMock(), mock.MagicMock()])
def test__get_cached_client(self, mock_clients):
def test__get_cached_client(self):
self.assertIsNone(manager.SeekAndDestroy._get_cached_client(None))
users = [{"credential": "a"}, {"credential": "b"}]
@ -47,9 +45,7 @@ class SeekAndDestroyTestCase(test.TestCase):
manager.SeekAndDestroy._get_cached_client(users[0], cache=cache),
manager.SeekAndDestroy._get_cached_client(users[1], cache=cache))
@mock.patch("%s.osclients.Clients" % BASE,
side_effect=[mock.MagicMock(), mock.MagicMock()])
def test__get_cached_client_with_api_versions(self, mock_clients):
def test__get_cached_client_with_api_versions(self):
self.assertIsNone(manager.SeekAndDestroy._get_cached_client(None))
user = {"credential": "a"}