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
This commit is contained in:
asarfaty 2020-07-22 08:15:16 +02:00
parent f6d3e82f5e
commit 5d997b42d5
3 changed files with 7 additions and 7 deletions

View File

@ -204,7 +204,7 @@ class TestPluginWithDefaultPlugin(NsxTVDPluginTestCase):
self._test_plugin_initialized() self._test_plugin_initialized()
# no unsupported extensions for the nsx_t plugin # no unsupported extensions for the nsx_t plugin
self.assertItemsEqual( self.assertCountEqual(
['router_type', 'router_size'], ['router_type', 'router_size'],
self.core_plugin._unsupported_fields[self.plugin_type]['router']) self.core_plugin._unsupported_fields[self.plugin_type]['router'])
self.assertEqual( self.assertEqual(
@ -408,7 +408,7 @@ class TestPluginWithDvs(TestPluginWithDefaultPlugin):
self._test_plugin_initialized() self._test_plugin_initialized()
# no unsupported extensions for the dvs plugin # no unsupported extensions for the dvs plugin
self.assertItemsEqual( self.assertCountEqual(
['mac_learning_enabled', 'provider_security_groups'], ['mac_learning_enabled', 'provider_security_groups'],
self.core_plugin._unsupported_fields[self.plugin_type]['port']) self.core_plugin._unsupported_fields[self.plugin_type]['port'])

View File

@ -1448,7 +1448,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2):
name=mock.ANY, name=mock.ANY,
tags=mock.ANY) tags=mock.ANY)
# Compare tags - kw args are the last item of a mock call tuple # 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-id', 'tag': 'xxx-xxx'},
{'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'},
{'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}])
@ -1469,7 +1469,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2):
name=mock.ANY, name=mock.ANY,
tags=mock.ANY) tags=mock.ANY)
# Compare tags - kw args are the last item of a mock call tuple # 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-id', 'tag': 'xxx-xxx'},
{'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'},
{'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}])

View File

@ -1267,7 +1267,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2):
display_name=mock.ANY, display_name=mock.ANY,
tags=mock.ANY) tags=mock.ANY)
# Compare tags - kw args are the last item of a mock call tuple # 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-id', 'tag': 'xxx-xxx'},
{'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'},
{'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}])
@ -1290,7 +1290,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2):
display_name=mock.ANY, display_name=mock.ANY,
tags=mock.ANY) tags=mock.ANY)
# Compare tags - kw args are the last item of a mock call tuple # 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-id', 'tag': 'xxx-xxx'},
{'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'},
{'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}])
@ -1312,7 +1312,7 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2):
display_name=mock.ANY, display_name=mock.ANY,
tags=mock.ANY) tags=mock.ANY)
# Compare tags - kw args are the last item of a mock call tuple # 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-id', 'tag': 'xxx-xxx'},
{'scope': 'os-lbaas-lb-name', 'tag': 'lb1'}, {'scope': 'os-lbaas-lb-name', 'tag': 'lb1'},
{'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}]) {'scope': 'os-lbaas-listener-id', 'tag': 'listener-x'}])