From 7a31c2e438da2d165f473f7428cee7d2164312df Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Tue, 27 Aug 2019 03:52:08 +0000 Subject: Fix py3 related issue Change-Id: I2b21aaab2cbf0df11b9940bf62585294dd1ce576 Issue-ID: MULTICLOUD-774 Signed-off-by: Bin Yang --- newton/newton/extensions/tests/test_extensions.py | 2 +- newton/newton/requests/tests/test_util.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'newton') diff --git a/newton/newton/extensions/tests/test_extensions.py b/newton/newton/extensions/tests/test_extensions.py index 0a89c8b7..51e801f1 100644 --- a/newton/newton/extensions/tests/test_extensions.py +++ b/newton/newton/extensions/tests/test_extensions.py @@ -34,7 +34,7 @@ class TestExtensions(unittest.TestCase): json_content = response.json() self.assertEquals(status.HTTP_200_OK, response.status_code) - self.assertEquals(4, len(json_content.keys())) + self.assertEquals(4, len(list(json_content.keys()))) self.assertEquals(cloud_owner, json_content["cloud-owner"]) self.assertEquals(cloud_region_id, diff --git a/newton/newton/requests/tests/test_util.py b/newton/newton/requests/tests/test_util.py index 71f66aa0..1be2a76f 100644 --- a/newton/newton/requests/tests/test_util.py +++ b/newton/newton/requests/tests/test_util.py @@ -138,12 +138,12 @@ class TestUtil(unittest.TestCase): "ram": "16G" } new_keys = ["tenantId", "memory"] - mapping = [(o, n) for o, n in zip(dict_obj.keys(), new_keys)] + mapping = [(o, n) for o, n in zip(list(dict_obj.keys()), new_keys)] util.VimDriverUtils.replace_key_by_mapping( dict_obj, mapping) - self.assertEqual(len(new_keys), len(dict_obj.keys())) - self.assertEqual(sorted(new_keys), sorted(dict_obj.keys())) + self.assertEqual(len(new_keys), len(list(dict_obj.keys()))) + self.assertEqual(sorted(new_keys), sorted(list(dict_obj.keys()))) def test_replace_keys_reverse_order(self): dict_obj = { @@ -151,9 +151,9 @@ class TestUtil(unittest.TestCase): "ram": "16G" } new_keys = ["tenantId", "memory"] - mapping = [(n, o) for o, n in zip(dict_obj.keys(), new_keys)] + mapping = [(n, o) for o, n in zip(list(dict_obj.keys()), new_keys)] util.VimDriverUtils.replace_key_by_mapping( dict_obj, mapping, reverse=True) - self.assertEqual(len(new_keys), len(dict_obj.keys())) - self.assertEqual(sorted(new_keys), sorted(dict_obj.keys())) + self.assertEqual(len(new_keys), len(list(dict_obj.keys()))) + self.assertEqual(sorted(new_keys), sorted(list(dict_obj.keys()))) -- cgit 1.2.3-korg