From 5d997b42d5ae3cc166813636d5c885cf0bfcde38 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Wed, 22 Jul 2020 08:15:16 +0200 Subject: [PATCH] Replace assertItemsEqual with assertCountEqual assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 so we should switch to use assertCountEqual. Following neutron example from I7c20fec08e5dc9f67b34100c925ea6724bbd25f0 Change-Id: I7a46b65b654d4c7c3f28c03a3097384744c2dc4d --- vmware_nsx/tests/unit/nsx_tvd/test_plugin.py | 4 ++-- vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py | 4 ++-- vmware_nsx/tests/unit/services/lbaas/test_nsxv3_driver.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vmware_nsx/tests/unit/nsx_tvd/test_plugin.py b/vmware_nsx/tests/unit/nsx_tvd/test_plugin.py index 2dcb2cb9c3..b5507cb57b 100644 --- a/vmware_nsx/tests/unit/nsx_tvd/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_tvd/test_plugin.py @@ -204,7 +204,7 @@ class TestPluginWithDefaultPlugin(NsxTVDPluginTestCase): self._test_plugin_initialized() # no unsupported extensions for the nsx_t plugin - self.assertItemsEqual( + self.assertCountEqual( ['router_type', 'router_size'], self.core_plugin._unsupported_fields[self.plugin_type]['router']) self.assertEqual( @@ -408,7 +408,7 @@ class TestPluginWithDvs(TestPluginWithDefaultPlugin): self._test_plugin_initialized() # no unsupported extensions for the dvs plugin - self.assertItemsEqual( + self.assertCountEqual( ['mac_learning_enabled', 'provider_security_groups'], self.core_plugin._unsupported_fields[self.plugin_type]['port']) diff --git a/vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py b/vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py index b7c5d984ad..cc69600a5c 100644 --- a/vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py +++ b/vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py @@ -1448,7 +1448,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2): name=mock.ANY, tags=mock.ANY) # Compare tags - kw args are the last item of a mock call tuple - self.assertItemsEqual(mock_create_pp.mock_calls[0][-1]['tags'], + self.assertCountEqual(mock_create_pp.mock_calls[0][-1]['tags'], [{'scope': 'os-lbaas-lb-id', 'tag': 'xxx-xxx'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) @@ -1469,7 +1469,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2): name=mock.ANY, tags=mock.ANY) # Compare tags - kw args are the last item of a mock call tuple - self.assertItemsEqual(mock_update_pp.mock_calls[0][-1]['tags'], + self.assertCountEqual(mock_update_pp.mock_calls[0][-1]['tags'], [{'scope': 'os-lbaas-lb-id', 'tag': 'xxx-xxx'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) diff --git a/vmware_nsx/tests/unit/services/lbaas/test_nsxv3_driver.py b/vmware_nsx/tests/unit/services/lbaas/test_nsxv3_driver.py index 79aa56737b..e9d5ced73a 100644 --- a/vmware_nsx/tests/unit/services/lbaas/test_nsxv3_driver.py +++ b/vmware_nsx/tests/unit/services/lbaas/test_nsxv3_driver.py @@ -1267,7 +1267,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2): display_name=mock.ANY, tags=mock.ANY) # Compare tags - kw args are the last item of a mock call tuple - self.assertItemsEqual(mock_create_pp.mock_calls[0][-1]['tags'], + self.assertCountEqual(mock_create_pp.mock_calls[0][-1]['tags'], [{'scope': 'os-lbaas-lb-id', 'tag': 'xxx-xxx'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) @@ -1290,7 +1290,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2): display_name=mock.ANY, tags=mock.ANY) # Compare tags - kw args are the last item of a mock call tuple - self.assertItemsEqual(mock_update_pp.mock_calls[0][-1]['tags'], + self.assertCountEqual(mock_update_pp.mock_calls[0][-1]['tags'], [{'scope': 'os-lbaas-lb-id', 'tag': 'xxx-xxx'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) @@ -1312,7 +1312,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2): display_name=mock.ANY, tags=mock.ANY) # Compare tags - kw args are the last item of a mock call tuple - self.assertItemsEqual(mock_create_pp.mock_calls[0][-1]['tags'], + self.assertCountEqual(mock_create_pp.mock_calls[0][-1]['tags'], [{'scope': 'os-lbaas-lb-id', 'tag': 'xxx-xxx'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}])