Skip to content

Commit

Permalink
Python 3 fix '+' operand in dict in test_osclients.py
Browse files Browse the repository at this point in the history
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
  • Loading branch information
arxcruz committed Jan 7, 2015
1 parent a731711 commit e3f71de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/unit/test_osclients.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def test_keystone(self):
endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout,
"insecure": False, "cacert": None,
"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.assertEqual(self.clients.cache["keystone"], self.fake_keystone)

Expand All @@ -74,7 +75,8 @@ def test_keystone_with_https_auth_url(self):
endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout,
"insecure": False, "cacert": None,
"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.assertEqual(self.clients_https.cache["keystone"],
self.fake_keystone)
Expand Down

0 comments on commit e3f71de

Please sign in to comment.