Make use of comparable 'FormattableColumn' subclasses

This requires fixes found in cliff 3.5.0 [1] and osc-lib 2.3.0 [2]. With
these fixes in place, we can remove the icky, still broken
'assertItemEqual' and 'assertListItemEqual' helpers.

[1] https://review.opendev.org/761421
[2] https://review.opendev.org/761394

Change-Id: Id6c26b37c3c7d5ec6761361abca57f9219b76838
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
changes/47/761447/6
Stephen Finucane 2 years ago
parent 0edd055f3f
commit f5b185c357
  1. 4
      lower-constraints.txt
  2. 2
      openstackclient/identity/v2_0/catalog.py
  3. 16
      openstackclient/tests/unit/compute/v2/test_aggregate.py
  4. 16
      openstackclient/tests/unit/compute/v2/test_flavor.py
  5. 6
      openstackclient/tests/unit/compute/v2/test_server_backup.py
  6. 6
      openstackclient/tests/unit/compute/v2/test_server_image.py
  7. 17
      openstackclient/tests/unit/identity/v2_0/test_catalog.py
  8. 2
      openstackclient/tests/unit/identity/v2_0/test_project.py
  9. 8
      openstackclient/tests/unit/identity/v2_0/test_user.py
  10. 10
      openstackclient/tests/unit/identity/v3/test_catalog.py
  11. 24
      openstackclient/tests/unit/identity/v3/test_identity_provider.py
  12. 10
      openstackclient/tests/unit/image/v1/test_image.py
  13. 22
      openstackclient/tests/unit/image/v2/test_image.py
  14. 8
      openstackclient/tests/unit/network/v2/test_ip_availability.py
  15. 46
      openstackclient/tests/unit/network/v2/test_network.py
  16. 14
      openstackclient/tests/unit/network/v2/test_network_agent.py
  17. 64
      openstackclient/tests/unit/network/v2/test_port.py
  18. 32
      openstackclient/tests/unit/network/v2/test_router.py
  19. 10
      openstackclient/tests/unit/network/v2/test_security_group_compute.py
  20. 16
      openstackclient/tests/unit/network/v2/test_security_group_network.py
  21. 42
      openstackclient/tests/unit/network/v2/test_subnet.py
  22. 40
      openstackclient/tests/unit/network/v2/test_subnet_pool.py
  23. 16
      openstackclient/tests/unit/utils.py
  24. 12
      openstackclient/tests/unit/volume/v1/test_qos_specs.py
  25. 14
      openstackclient/tests/unit/volume/v1/test_type.py
  26. 36
      openstackclient/tests/unit/volume/v1/test_volume.py
  27. 10
      openstackclient/tests/unit/volume/v1/test_volume_backup.py
  28. 14
      openstackclient/tests/unit/volume/v2/test_consistency_group.py
  29. 12
      openstackclient/tests/unit/volume/v2/test_qos_specs.py
  30. 24
      openstackclient/tests/unit/volume/v2/test_type.py
  31. 40
      openstackclient/tests/unit/volume/v2/test_volume.py
  32. 4
      openstackclient/tests/unit/volume/v2/test_volume_backup.py
  33. 4
      requirements.txt

@ -5,7 +5,7 @@ Babel==2.6.0
bcrypt==3.2.0
cachetools==2.0.0
cffi==1.14.0
cliff==3.4.0
cliff==3.5.0
cmd2==0.8.0
coverage==4.0
cryptography==2.7
@ -42,7 +42,7 @@ openstacksdk==0.52.0
os-client-config==2.1.0
os-service-types==1.7.0
os-testr==1.0.0
osc-lib==2.2.0
osc-lib==2.3.0
oslo.concurrency==3.26.0
oslo.config==5.2.0
oslo.context==2.19.2

@ -91,7 +91,7 @@ class ShowCatalog(command.ShowOne):
for service in auth_ref.service_catalog.catalog:
if (service.get('name') == parsed_args.service or
service.get('type') == parsed_args.service):
data = service
data = service.copy()
data['endpoints'] = EndpointsColumn(data['endpoints'])
if 'endpoints_links' in data:
data.pop('endpoints_links')

@ -88,7 +88,7 @@ class TestAggregateAddHost(TestAggregate):
self.sdk_client.add_host_to_aggregate.assert_called_once_with(
self.fake_ag.id, parsed_args.host)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestAggregateCreate(TestAggregate):
@ -112,7 +112,7 @@ class TestAggregateCreate(TestAggregate):
self.sdk_client.create_aggregate.assert_called_once_with(
name=parsed_args.name)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_aggregate_create_with_zone(self):
arglist = [
@ -129,7 +129,7 @@ class TestAggregateCreate(TestAggregate):
self.sdk_client.create_aggregate.assert_called_once_with(
name=parsed_args.name, availability_zone=parsed_args.zone)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_aggregate_create_with_property(self):
arglist = [
@ -148,7 +148,7 @@ class TestAggregateCreate(TestAggregate):
self.sdk_client.set_aggregate_metadata.assert_called_once_with(
self.fake_ag.id, parsed_args.property)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestAggregateDelete(TestAggregate):
@ -265,7 +265,7 @@ class TestAggregateList(TestAggregate):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.list_columns, columns)
self.assertItemEqual(self.list_data, tuple(data))
self.assertItemsEqual(self.list_data, tuple(data))
def test_aggregate_list_with_long(self):
arglist = [
@ -278,7 +278,7 @@ class TestAggregateList(TestAggregate):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.list_columns_long, columns)
self.assertListItemEqual(self.list_data_long, tuple(data))
self.assertItemsEqual(self.list_data_long, tuple(data))
class TestAggregateRemoveHost(TestAggregate):
@ -306,7 +306,7 @@ class TestAggregateRemoveHost(TestAggregate):
self.sdk_client.remove_host_from_aggregate.assert_called_once_with(
self.fake_ag.id, parsed_args.host)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestAggregateSet(TestAggregate):
@ -492,7 +492,7 @@ class TestAggregateShow(TestAggregate):
parsed_args.aggregate, ignore_missing=False)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, tuple(data))
self.assertItemsEqual(self.data, tuple(data))
class TestAggregateUnset(TestAggregate):

@ -133,7 +133,7 @@ class TestFlavorCreate(TestFlavor):
self.sdk_client.create_flavor.assert_called_once_with(**default_args)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_flavor_create_all_options(self):
@ -201,8 +201,8 @@ class TestFlavorCreate(TestFlavor):
create_flavor, props)
self.sdk_client.get_flavor_access.assert_not_called()
self.assertEqual(self.columns, columns)
self.assertItemEqual(tuple(cmp_data), data)
self.assertEqual(self.columns, columns)
self.assertItemsEqual(tuple(cmp_data), data)
def test_flavor_create_other_options(self):
@ -277,7 +277,7 @@ class TestFlavorCreate(TestFlavor):
self.sdk_client.create_flavor_extra_specs.assert_called_with(
create_flavor, props)
self.assertEqual(self.columns, columns)
self.assertItemEqual(cmp_data, data)
self.assertItemsEqual(cmp_data, data)
def test_public_flavor_create_with_project(self):
arglist = [
@ -350,7 +350,7 @@ class TestFlavorCreate(TestFlavor):
self.sdk_client.create_flavor.assert_called_once_with(**args)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data_private, data)
self.assertItemsEqual(self.data_private, data)
def test_flavor_create_with_description_api_older(self):
arglist = [
@ -633,7 +633,7 @@ class TestFlavorList(TestFlavor):
)
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, tuple(data))
self.assertItemsEqual(self.data_long, tuple(data))
class TestFlavorSet(TestFlavor):
@ -920,7 +920,7 @@ class TestFlavorShow(TestFlavor):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_private_flavor_show(self):
private_flavor = compute_fakes.FakeFlavor.create_one_flavor(
@ -960,7 +960,7 @@ class TestFlavorShow(TestFlavor):
self.sdk_client.get_flavor_access.assert_called_with(
flavor=private_flavor.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(data_with_project, data)
self.assertItemsEqual(data_with_project, data)
class TestFlavorUnset(TestFlavor):

@ -139,7 +139,7 @@ class TestServerBackupCreate(TestServerBackup):
)
self.assertEqual(self.image_columns(images[0]), columns)
self.assertItemEqual(self.image_data(images[0]), data)
self.assertItemsEqual(self.image_data(images[0]), data)
def test_server_backup_create_options(self):
servers = self.setup_servers_mock(count=1)
@ -173,7 +173,7 @@ class TestServerBackupCreate(TestServerBackup):
)
self.assertEqual(self.image_columns(images[0]), columns)
self.assertItemEqual(self.image_data(images[0]), data)
self.assertItemsEqual(self.image_data(images[0]), data)
@mock.patch.object(common_utils, 'wait_for_status', return_value=False)
def test_server_backup_wait_fail(self, mock_wait_for_status):
@ -269,4 +269,4 @@ class TestServerBackupCreate(TestServerBackup):
)
self.assertEqual(self.image_columns(images[0]), columns)
self.assertItemEqual(self.image_data(images[0]), data)
self.assertItemsEqual(self.image_data(images[0]), data)

@ -133,7 +133,7 @@ class TestServerImageCreate(TestServerImage):
)
self.assertEqual(self.image_columns(images[0]), columns)
self.assertItemEqual(self.image_data(images[0]), data)
self.assertItemsEqual(self.image_data(images[0]), data)
def test_server_image_create_options(self):
servers = self.setup_servers_mock(count=1)
@ -161,7 +161,7 @@ class TestServerImageCreate(TestServerImage):
)
self.assertEqual(self.image_columns(images[0]), columns)
self.assertItemEqual(self.image_data(images[0]), data)
self.assertItemsEqual(self.image_data(images[0]), data)
@mock.patch.object(common_utils, 'wait_for_status', return_value=False)
def test_server_create_image_wait_fail(self, mock_wait_for_status):
@ -229,4 +229,4 @@ class TestServerImageCreate(TestServerImage):
)
self.assertEqual(self.image_columns(images[0]), columns)
self.assertItemEqual(self.image_data(images[0]), data)
self.assertItemsEqual(self.image_data(images[0]), data)

@ -71,9 +71,10 @@ class TestCatalogList(TestCatalog):
datalist = ((
'supernova',
'compute',
catalog.EndpointsColumn(self.service_catalog['endpoints']),
catalog.EndpointsColumn(
auth_ref.service_catalog.catalog[0]['endpoints']),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_catalog_list_with_endpoint_url(self):
attr = {
@ -113,9 +114,10 @@ class TestCatalogList(TestCatalog):
datalist = ((
'supernova',
'compute',
catalog.EndpointsColumn(service_catalog['endpoints']),
catalog.EndpointsColumn(
auth_ref.service_catalog.catalog[0]['endpoints']),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
class TestCatalogShow(TestCatalog):
@ -150,16 +152,17 @@ class TestCatalogShow(TestCatalog):
collist = ('endpoints', 'id', 'name', 'type')
self.assertEqual(collist, columns)
datalist = (
catalog.EndpointsColumn(self.service_catalog['endpoints']),
catalog.EndpointsColumn(
auth_ref.service_catalog.catalog[0]['endpoints']),
self.service_catalog.id,
'supernova',
'compute',
)
self.assertItemEqual(datalist, data)
self.assertItemsEqual(datalist, data)
class TestFormatColumns(TestCatalog):
def test_endpoints_column_human_readabale(self):
def test_endpoints_column_human_readable(self):
col = catalog.EndpointsColumn(self.service_catalog['endpoints'])
self.assertEqual(
'one\n publicURL: https://public.one.example.com\n '

@ -643,7 +643,7 @@ class TestProjectShow(TestProject):
self.fake_proj_show.name,
format_columns.DictColumn({}),
)
self.assertItemEqual(datalist, data)
self.assertItemsEqual(datalist, data)
class TestProjectUnset(TestProject):

@ -482,7 +482,7 @@ class TestUserList(TestUser):
self.users_mock.list.assert_called_with(tenant_id=None)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_user_list_project(self):
arglist = [
@ -502,7 +502,7 @@ class TestUserList(TestUser):
self.users_mock.list.assert_called_with(tenant_id=project_id)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_user_list_long(self):
arglist = [
@ -531,7 +531,7 @@ class TestUserList(TestUser):
self.fake_user_l.email,
True,
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
class TestUserSet(TestUser):
@ -819,4 +819,4 @@ class TestUserShow(TestUser):
self.fake_user.name,
self.fake_project.id,
)
self.assertItemEqual(datalist, data)
self.assertItemsEqual(datalist, data)

@ -91,9 +91,10 @@ class TestCatalogList(TestCatalog):
datalist = ((
'supernova',
'compute',
catalog.EndpointsColumn(self.fake_service['endpoints']),
catalog.EndpointsColumn(
auth_ref.service_catalog.catalog[0]['endpoints']),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
class TestCatalogShow(TestCatalog):
@ -128,12 +129,13 @@ class TestCatalogShow(TestCatalog):
collist = ('endpoints', 'id', 'name', 'type')
self.assertEqual(collist, columns)
datalist = (
catalog.EndpointsColumn(self.fake_service['endpoints']),
catalog.EndpointsColumn(
auth_ref.service_catalog.catalog[0]['endpoints']),
'qwertyuiop',
'supernova',
'compute',
)
self.assertItemEqual(datalist, data)
self.assertItemsEqual(datalist, data)
class TestFormatColumns(TestCatalog):

@ -89,7 +89,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_create_identity_provider_description(self):
arglist = [
@ -117,7 +117,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_create_identity_provider_remote_id(self):
arglist = [
@ -145,7 +145,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_create_identity_provider_remote_ids_multiple(self):
arglist = [
@ -174,7 +174,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_create_identity_provider_remote_ids_file(self):
arglist = [
@ -207,7 +207,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_create_identity_provider_disabled(self):
@ -250,7 +250,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
identity_fakes.idp_id,
identity_fakes.formatted_idp_remote_ids
)
self.assertItemEqual(datalist, data)
self.assertItemsEqual(datalist, data)
def test_create_identity_provider_domain_name(self):
arglist = [
@ -278,7 +278,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_create_identity_provider_domain_id(self):
arglist = [
@ -306,7 +306,7 @@ class TestIdentityProviderCreate(TestIdentityProvider):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
class TestIdentityProviderDelete(TestIdentityProvider):
@ -382,7 +382,7 @@ class TestIdentityProviderList(TestIdentityProvider):
identity_fakes.domain_id,
identity_fakes.idp_description,
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_identity_provider_list_ID_option(self):
arglist = ['--id',
@ -410,7 +410,7 @@ class TestIdentityProviderList(TestIdentityProvider):
identity_fakes.domain_id,
identity_fakes.idp_description,
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_identity_provider_list_enabled_option(self):
arglist = ['--enabled']
@ -437,7 +437,7 @@ class TestIdentityProviderList(TestIdentityProvider):
identity_fakes.domain_id,
identity_fakes.idp_description,
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
class TestIdentityProviderSet(TestIdentityProvider):
@ -722,4 +722,4 @@ class TestIdentityProviderShow(TestIdentityProvider):
identity_fakes.idp_id,
identity_fakes.formatted_idp_remote_ids
)
self.assertItemEqual(datalist, data)
self.assertItemsEqual(datalist, data)

@ -100,7 +100,7 @@ class TestImageCreate(TestImage):
self.assertEqual(self.client.update_image.call_args_list, [])
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
@mock.patch('sys.stdin', side_effect=[None])
def test_image_reserve_options(self, raw_input):
@ -149,7 +149,7 @@ class TestImageCreate(TestImage):
self.assertEqual(self.client.update_image.call_args_list, [])
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
@mock.patch('openstackclient.image.v1.image.io.open', name='Open')
def test_image_create_file(self, mock_open):
@ -205,7 +205,7 @@ class TestImageCreate(TestImage):
self.assertEqual(self.client.update_image.call_args_list, [])
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestImageDelete(TestImage):
@ -386,7 +386,7 @@ class TestImageList(TestImage):
format_columns.DictColumn(
{'Alpha': 'a', 'Beta': 'b', 'Gamma': 'g'}),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
@mock.patch('osc_lib.api.utils.simple_filter')
def test_image_list_property_option(self, sf_mock):
@ -737,7 +737,7 @@ class TestImageShow(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_image_show_human_readable(self):
arglist = [

@ -111,7 +111,7 @@ class TestImageCreate(TestImage):
self.assertEqual(
self.expected_columns,
columns)
self.assertItemEqual(
self.assertItemsEqual(
self.expected_data,
data)
@ -166,7 +166,7 @@ class TestImageCreate(TestImage):
self.assertEqual(
self.expected_columns,
columns)
self.assertItemEqual(
self.assertItemsEqual(
self.expected_data,
data)
@ -255,7 +255,7 @@ class TestImageCreate(TestImage):
self.assertEqual(
self.expected_columns,
columns)
self.assertItemEqual(
self.assertItemsEqual(
self.expected_data,
data)
@ -513,7 +513,7 @@ class TestImageList(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_image_list_public_option(self):
arglist = [
@ -537,7 +537,7 @@ class TestImageList(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_image_list_private_option(self):
arglist = [
@ -561,7 +561,7 @@ class TestImageList(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_image_list_community_option(self):
arglist = [
@ -609,7 +609,7 @@ class TestImageList(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_image_list_shared_member_status_option(self):
arglist = [
@ -697,7 +697,7 @@ class TestImageList(TestImage):
self._image.owner_id,
format_columns.ListColumn(self._image.tags),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
@mock.patch('osc_lib.api.utils.simple_filter')
def test_image_list_property_option(self, sf_mock):
@ -725,7 +725,7 @@ class TestImageList(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
@mock.patch('osc_lib.utils.sort_items')
def test_image_list_sort_option(self, si_mock):
@ -747,7 +747,7 @@ class TestImageList(TestImage):
str,
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_image_list_limit_option(self):
ret_limit = 1
@ -1472,7 +1472,7 @@ class TestImageShow(TestImage):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_image_show_human_readable(self):
self.client.find_image.return_value = self.new_image

@ -75,7 +75,7 @@ class TestListIPAvailability(TestIPAvailability):
self.network.network_ip_availabilities.assert_called_once_with(
**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_list_ip_version(self):
arglist = [
@ -93,7 +93,7 @@ class TestListIPAvailability(TestIPAvailability):
self.network.network_ip_availabilities.assert_called_once_with(
**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_list_project(self):
arglist = [
@ -113,7 +113,7 @@ class TestListIPAvailability(TestIPAvailability):
self.network.network_ip_availabilities.assert_called_once_with(
**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
class TestShowIPAvailability(TestIPAvailability):
@ -176,4 +176,4 @@ class TestShowIPAvailability(TestIPAvailability):
self._ip_availability.network_name,
ignore_missing=False)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)

@ -146,7 +146,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
})
self.assertFalse(self.network.set_tags.called)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_all_options(self):
arglist = [
@ -211,7 +211,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
'dns_domain': 'example.org.',
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_other_options(self):
arglist = [
@ -238,7 +238,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
'port_security_enabled': False,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def _test_create_with_tag(self, add_tags=True):
arglist = [self._network.name]
@ -270,7 +270,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
else:
self.assertFalse(self.network.set_tags.called)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_tags(self):
self._test_create_with_tag(add_tags=True)
@ -385,7 +385,7 @@ class TestCreateNetworkIdentityV2(TestNetwork):
})
self.assertFalse(self.network.set_tags.called)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_domain_identityv2(self):
arglist = [
@ -577,7 +577,7 @@ class TestListNetwork(TestNetwork):
self.network.networks.assert_called_once_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_list_external(self):
arglist = [
@ -598,7 +598,7 @@ class TestListNetwork(TestNetwork):
**{'router:external': True, 'is_router_external': True}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_list_internal(self):
arglist = [
@ -615,7 +615,7 @@ class TestListNetwork(TestNetwork):
**{'router:external': False, 'is_router_external': False}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_long(self):
arglist = [
@ -634,7 +634,7 @@ class TestListNetwork(TestNetwork):
self.network.networks.assert_called_once_with()
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, list(data))
self.assertItemsEqual(self.data_long, list(data))
def test_list_name(self):
test_name = "fakename"
@ -653,7 +653,7 @@ class TestListNetwork(TestNetwork):
**{'name': test_name}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_enable(self):
arglist = [
@ -671,7 +671,7 @@ class TestListNetwork(TestNetwork):
**{'admin_state_up': True, 'is_admin_state_up': True}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_disable(self):
arglist = [
@ -689,7 +689,7 @@ class TestListNetwork(TestNetwork):
**{'admin_state_up': False, 'is_admin_state_up': False}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_project(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -708,7 +708,7 @@ class TestListNetwork(TestNetwork):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_project_domain(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -727,7 +727,7 @@ class TestListNetwork(TestNetwork):
self.network.networks.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_share(self):
arglist = [
@ -744,7 +744,7 @@ class TestListNetwork(TestNetwork):
**{'shared': True, 'is_shared': True}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_no_share(self):
arglist = [
@ -761,7 +761,7 @@ class TestListNetwork(TestNetwork):
**{'shared': False, 'is_shared': False}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_status(self):
choices = ['ACTIVE', 'BUILD', 'DOWN', 'ERROR']
@ -780,7 +780,7 @@ class TestListNetwork(TestNetwork):
**{'status': test_status}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_provider_network_type(self):
network_type = self._network[0].provider_network_type
@ -798,7 +798,7 @@ class TestListNetwork(TestNetwork):
'provider_network_type': network_type}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_provider_physical_network(self):
physical_network = self._network[0].provider_physical_network
@ -816,7 +816,7 @@ class TestListNetwork(TestNetwork):
'provider_physical_network': physical_network}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_provider_segment(self):
segmentation_id = self._network[0].provider_segmentation_id
@ -834,7 +834,7 @@ class TestListNetwork(TestNetwork):
'provider_segmentation_id': segmentation_id}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_list_dhcp_agent(self):
arglist = [
@ -853,7 +853,7 @@ class TestListNetwork(TestNetwork):
*attrs)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(list(data), list(self.data))
self.assertItemsEqual(list(data), list(self.data))
def test_list_with_tag_options(self):
arglist = [
@ -878,7 +878,7 @@ class TestListNetwork(TestNetwork):
'not_any_tags': 'black,white'}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
class TestSetNetwork(TestNetwork):
@ -1111,7 +1111,7 @@ class TestShowNetwork(TestNetwork):
self._network.name, ignore_missing=False)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestUnsetNetwork(TestNetwork):

@ -246,7 +246,7 @@ class TestListNetworkAgent(TestNetworkAgent):
self.network.agents.assert_called_once_with(**{})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_agents_list_agent_type(self):
arglist = [
@ -263,7 +263,7 @@ class TestListNetworkAgent(TestNetworkAgent):
'agent_type': 'DHCP agent',
})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_agents_list_host(self):
arglist = [
@ -280,7 +280,7 @@ class TestListNetworkAgent(TestNetworkAgent):
'host': self.network_agents[0].host,
})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_agents_list_networks(self):
arglist = [
@ -298,7 +298,7 @@ class TestListNetworkAgent(TestNetworkAgent):
self.network.network_hosting_dhcp_agents.assert_called_once_with(
*attrs)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_agents_list_routers(self):
arglist = [
@ -318,7 +318,7 @@ class TestListNetworkAgent(TestNetworkAgent):
*attrs)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_network_agents_list_routers_with_long_option(self):
arglist = [
@ -343,7 +343,7 @@ class TestListNetworkAgent(TestNetworkAgent):
router_agent_data = [d + ('',) for d in self.data]
self.assertEqual(router_agent_columns, columns)
self.assertListItemEqual(router_agent_data, list(data))
self.assertItemsEqual(router_agent_data, list(data))
class TestRemoveNetworkFromAgent(TestNetworkAgent):
@ -571,4 +571,4 @@ class TestShowNetworkAgent(TestNetworkAgent):
self.network.get_agent.assert_called_once_with(
self._network_agent.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(list(self.data), list(data))
self.assertItemsEqual(list(self.data), list(data))

@ -151,7 +151,7 @@ class TestCreatePort(TestPort):
self.assertFalse(self.network.set_tags.called)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_full_options(self):
arglist = [
@ -209,7 +209,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_invalid_json_binding_profile(self):
arglist = [
@ -260,7 +260,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_security_group(self):
secgroup = network_fakes.FakeSecurityGroup.create_one_security_group()
@ -289,7 +289,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_port_with_dns_name(self):
arglist = [
@ -315,7 +315,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_security_groups(self):
sg_1 = network_fakes.FakeSecurityGroup.create_one_security_group()
@ -345,7 +345,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_no_security_groups(self):
arglist = [
@ -371,7 +371,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_no_fixed_ips(self):
arglist = [
@ -397,7 +397,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_port_with_allowed_address_pair_ipaddr(self):
pairs = [{'ip_address': '192.168.1.123'},
@ -427,7 +427,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_port_with_allowed_address_pair(self):
pairs = [{'ip_address': '192.168.1.123',
@ -463,7 +463,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_port_with_qos(self):
qos_policy = network_fakes.FakeNetworkQosPolicy.create_one_qos_policy()
@ -491,7 +491,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_port_security_enabled(self):
arglist = [
@ -600,7 +600,7 @@ class TestCreatePort(TestPort):
self.assertFalse(self.network.set_tags.called)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_tags(self):
self._test_create_with_tag(add_tags=True, add_tags_in_post=True)
@ -643,7 +643,7 @@ class TestCreatePort(TestPort):
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_uplink_status_propagation_enabled(self):
self._test_create_with_uplink_status_propagation(enable=True)
@ -723,7 +723,7 @@ class TestCreatePort(TestPort):
self.network.create_port.assert_called_once_with(**create_args)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_numa_affinity_policy_required(self):
self._test_create_with_numa_affinity_policy(policy='required')
@ -890,7 +890,7 @@ class TestListPort(TestPort):
self.network.ports.assert_called_once_with(
fields=LIST_FIELDS_TO_RETRIEVE)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_port_list_router_opt(self):
arglist = [
@ -910,7 +910,7 @@ class TestListPort(TestPort):
'fields': LIST_FIELDS_TO_RETRIEVE,
})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
@mock.patch.object(utils, 'find_resource')
def test_port_list_with_server_option(self, mock_find):
@ -931,7 +931,7 @@ class TestListPort(TestPort):
fields=LIST_FIELDS_TO_RETRIEVE)
mock_find.assert_called_once_with(mock.ANY, 'fake-server-name')
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_port_list_device_id_opt(self):
arglist = [
@ -951,7 +951,7 @@ class TestListPort(TestPort):
'fields': LIST_FIELDS_TO_RETRIEVE,
})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_port_list_device_owner_opt(self):
arglist = [