Python 3 fix '+' operand in dict in test_osclients.py

In Python 3, the dict.items() return a dict_items object, which
does not support the + operand.
The way to make it compatible is using the update method in dict
object.

Change-Id: I99c94b9a2d99d54de5a93a4e15e82ab0173e5592
This commit is contained in:
Arx Cruz 2015-01-07 10:44:55 +01:00
parent a731711988
commit e3f71de978

View File

@ -63,7 +63,8 @@ class OSClientsTestCase(test.TestCase):
endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout, endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout,
"insecure": False, "cacert": None, "insecure": False, "cacert": None,
"endpoint": auth_url} "endpoint": auth_url}
kwargs = dict(self.endpoint.to_dict().items() + endpoint.items()) kwargs = self.endpoint.to_dict()
kwargs.update(endpoint.items())
self.mock_create_keystone_client.assert_called_once_with(kwargs) self.mock_create_keystone_client.assert_called_once_with(kwargs)
self.assertEqual(self.clients.cache["keystone"], self.fake_keystone) self.assertEqual(self.clients.cache["keystone"], self.fake_keystone)
@ -74,7 +75,8 @@ class OSClientsTestCase(test.TestCase):
endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout, endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout,
"insecure": False, "cacert": None, "insecure": False, "cacert": None,
"endpoint": self.endpoint_https.auth_url} "endpoint": self.endpoint_https.auth_url}
kwargs = dict(self.endpoint_https.to_dict().items() + endpoint.items()) kwargs = self.endpoint_https.to_dict()
kwargs.update(endpoint.items())
self.mock_create_keystone_client.assert_called_once_with(kwargs) self.mock_create_keystone_client.assert_called_once_with(kwargs)
self.assertEqual(self.clients_https.cache["keystone"], self.assertEqual(self.clients_https.cache["keystone"],
self.fake_keystone) self.fake_keystone)