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>
This commit is contained in:
Stephen Finucane 2020-11-04 16:16:58 +00:00
parent 0edd055f3f
commit f5b185c357
33 changed files with 295 additions and 306 deletions

View File

@ -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

View File

@ -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')

View File

@ -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):

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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 '

View File

@ -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):

View File

@ -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)

View File

@ -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):

View File

@ -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)

View File

@ -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 = [

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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))

View File

@ -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 = [
@ -971,7 +971,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_all_opt(self):
arglist = [
@ -1000,7 +1000,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_mac_address_opt(self):
arglist = [
@ -1020,7 +1020,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_fixed_ip_opt_ip_address(self):
ip_address = self._ports[0].fixed_ips[0]['ip_address']
@ -1040,7 +1040,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_fixed_ip_opt_ip_address_substr(self):
ip_address_ss = self._ports[0].fixed_ips[0]['ip_address'][:-1]
@ -1060,7 +1060,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_fixed_ip_opt_subnet_id(self):
subnet_id = self._ports[0].fixed_ips[0]['subnet_id']
@ -1082,7 +1082,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_fixed_ip_opts(self):
subnet_id = self._ports[0].fixed_ips[0]['subnet_id']
@ -1108,7 +1108,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_fixed_ips(self):
subnet_id = self._ports[0].fixed_ips[0]['subnet_id']
@ -1136,7 +1136,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_list_port_with_long(self):
arglist = [
@ -1154,7 +1154,7 @@ class TestListPort(TestPort):
self.network.ports.assert_called_once_with(
fields=LIST_FIELDS_TO_RETRIEVE + LIST_FIELDS_TO_RETRIEVE_LONG)
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, list(data))
self.assertItemsEqual(self.data_long, list(data))
def test_port_list_host(self):
arglist = [
@ -1173,7 +1173,7 @@ class TestListPort(TestPort):
self.network.ports.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_port_list_project(self):
project = identity_fakes.FakeProject.create_one_project()
@ -1195,7 +1195,7 @@ class TestListPort(TestPort):
self.network.ports.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_port_list_project_domain(self):
project = identity_fakes.FakeProject.create_one_project()
@ -1219,7 +1219,7 @@ class TestListPort(TestPort):
self.network.ports.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_with_tag_options(self):
arglist = [
@ -1245,7 +1245,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))
class TestSetPort(TestPort):
@ -1845,7 +1845,7 @@ class TestShowPort(TestPort):
self._port.name, ignore_missing=False)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestUnsetPort(TestPort):

View File

@ -184,7 +184,7 @@ class TestCreateRouter(TestRouter):
})
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_ha_options(self, option, ha):
arglist = [
@ -208,7 +208,7 @@ class TestCreateRouter(TestRouter):
'ha': ha,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_ha_option(self):
self._test_create_with_ha_options('--ha', True)
@ -237,7 +237,7 @@ class TestCreateRouter(TestRouter):
'distributed': distributed,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_distributed_option(self):
self._test_create_with_distributed_options('--distributed', True)
@ -268,7 +268,7 @@ class TestCreateRouter(TestRouter):
})
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.new_router.name]
@ -301,7 +301,7 @@ class TestCreateRouter(TestRouter):
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)
@ -494,7 +494,7 @@ class TestListRouter(TestRouter):
self.network.routers.assert_called_once_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_router_list_no_ha_no_distributed(self):
_routers = network_fakes.FakeRouter.create_routers({
@ -531,7 +531,7 @@ class TestListRouter(TestRouter):
self.network.routers.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_router_list_long_no_az(self):
arglist = [
@ -552,7 +552,7 @@ class TestListRouter(TestRouter):
self.network.routers.assert_called_once_with()
self.assertEqual(self.columns_long_no_az, columns)
self.assertListItemEqual(self.data_long_no_az, list(data))
self.assertItemsEqual(self.data_long_no_az, list(data))
def test_list_name(self):
test_name = "fakename"
@ -570,7 +570,7 @@ class TestListRouter(TestRouter):
**{'name': test_name}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_router_list_enable(self):
arglist = [
@ -587,7 +587,7 @@ class TestListRouter(TestRouter):
**{'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_router_list_disable(self):
arglist = [
@ -605,7 +605,7 @@ class TestListRouter(TestRouter):
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_router_list_project(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -623,7 +623,7 @@ class TestListRouter(TestRouter):
self.network.routers.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_router_list_project_domain(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -643,7 +643,7 @@ class TestListRouter(TestRouter):
self.network.routers.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_router_list_agents_no_args(self):
arglist = [
@ -671,7 +671,7 @@ class TestListRouter(TestRouter):
self.network.agent_hosted_routers(
*attrs)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_list_with_tag_options(self):
arglist = [
@ -696,7 +696,7 @@ class TestListRouter(TestRouter):
'not_any_tags': 'black,white'}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
class TestRemovePortFromRouter(TestRouter):
@ -1403,7 +1403,7 @@ class TestShowRouter(TestRouter):
'device_id': self._router.id
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_show_no_ha_no_distributed(self):
_router = network_fakes.FakeRouter.create_one_router({

View File

@ -88,7 +88,7 @@ class TestCreateSecurityGroupCompute(TestSecurityGroupCompute):
self._security_group['name'],
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_security_group_create_all_options(self, sg_mock):
sg_mock.return_value = self._security_group
@ -109,7 +109,7 @@ class TestCreateSecurityGroupCompute(TestSecurityGroupCompute):
self._security_group['description'],
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
@mock.patch(
@ -255,7 +255,7 @@ class TestListSecurityGroupCompute(TestSecurityGroupCompute):
kwargs = {'search_opts': {'all_tenants': False}}
sg_mock.assert_called_once_with(**kwargs)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_security_group_list_all_projects(self, sg_mock):
sg_mock.return_value = self._security_groups
@ -272,7 +272,7 @@ class TestListSecurityGroupCompute(TestSecurityGroupCompute):
kwargs = {'search_opts': {'all_tenants': True}}
sg_mock.assert_called_once_with(**kwargs)
self.assertEqual(self.columns_all_projects, columns)
self.assertListItemEqual(self.data_all_projects, list(data))
self.assertItemsEqual(self.data_all_projects, list(data))
@mock.patch(
@ -401,4 +401,4 @@ class TestShowSecurityGroupCompute(TestSecurityGroupCompute):
sg_mock.assert_called_once_with(self._security_group['id'])
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)

View File

@ -96,7 +96,7 @@ class TestCreateSecurityGroupNetwork(TestSecurityGroupNetwork):
'name': self._security_group.name,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_all_options(self):
arglist = [
@ -124,7 +124,7 @@ class TestCreateSecurityGroupNetwork(TestSecurityGroupNetwork):
'tenant_id': self.project.id,
})
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._security_group.name]
@ -155,7 +155,7 @@ class TestCreateSecurityGroupNetwork(TestSecurityGroupNetwork):
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)
@ -293,7 +293,7 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
self.network.security_groups.assert_called_once_with(
fields=security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_security_group_list_all_projects(self):
arglist = [
@ -309,7 +309,7 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
self.network.security_groups.assert_called_once_with(
fields=security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_security_group_list_project(self):
project = identity_fakes.FakeProject.create_one_project()
@ -329,7 +329,7 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
self.network.security_groups.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_security_group_list_project_domain(self):
project = identity_fakes.FakeProject.create_one_project()
@ -351,7 +351,7 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
self.network.security_groups.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_with_tag_options(self):
arglist = [
@ -539,7 +539,7 @@ class TestShowSecurityGroupNetwork(TestSecurityGroupNetwork):
self.network.find_security_group.assert_called_once_with(
self._security_group.id, ignore_missing=False)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestUnsetSecurityGroupNetwork(TestSecurityGroupNetwork):

View File

@ -255,7 +255,7 @@ class TestCreateSubnet(TestSubnet):
})
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_from_subnet_pool_options(self):
# Mock SDK calls for this test.
@ -317,7 +317,7 @@ class TestCreateSubnet(TestSubnet):
'service_types': self._subnet_from_pool.service_types,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data_subnet_pool, data)
self.assertItemsEqual(self.data_subnet_pool, data)
def test_create_options_subnet_range_ipv6(self):
# Mock SDK calls for this test.
@ -390,7 +390,7 @@ class TestCreateSubnet(TestSubnet):
})
self.assertFalse(self.network.set_tags.called)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data_ipv6, data)
self.assertItemsEqual(self.data_ipv6, data)
def test_create_with_network_segment(self):
# Mock SDK calls for this test.
@ -424,7 +424,7 @@ class TestCreateSubnet(TestSubnet):
})
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_description(self):
# Mock SDK calls for this test.
@ -458,7 +458,7 @@ class TestCreateSubnet(TestSubnet):
})
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_dns(self, publish_dns=True):
arglist = [
@ -490,7 +490,7 @@ class TestCreateSubnet(TestSubnet):
dns_publish_fixed_ip=publish_dns,
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_dns(self):
self._test_create_with_dns(publish_dns=True)
@ -535,7 +535,7 @@ class TestCreateSubnet(TestSubnet):
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)
@ -691,7 +691,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_long(self):
arglist = [
@ -706,7 +706,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.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_subnet_list_ip_version(self):
arglist = [
@ -722,7 +722,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_dhcp(self):
arglist = [
@ -738,7 +738,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_no_dhcp(self):
arglist = [
@ -754,7 +754,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_service_type(self):
arglist = [
@ -769,7 +769,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_project(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -787,7 +787,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_service_type_multiple(self):
arglist = [
@ -805,7 +805,7 @@ class TestListSubnet(TestSubnet):
'network:floatingip_agent_gateway']}
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_project_domain(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -825,7 +825,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_network(self):
network = network_fakes.FakeNetwork.create_one_network()
@ -843,7 +843,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_gateway(self):
subnet = network_fakes.FakeSubnet.create_one_subnet()
@ -861,7 +861,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_name(self):
subnet = network_fakes.FakeSubnet.create_one_subnet()
@ -879,7 +879,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_list_subnet_range(self):
subnet = network_fakes.FakeSubnet.create_one_subnet()
@ -897,7 +897,7 @@ class TestListSubnet(TestSubnet):
self.network.subnets.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_with_tag_options(self):
arglist = [
@ -1244,7 +1244,7 @@ class TestShowSubnet(TestSubnet):
self._subnet.name, ignore_missing=False)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestUnsetSubnet(TestSubnet):

View File

@ -133,7 +133,7 @@ class TestCreateSubnetPool(TestSubnetPool):
})
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_prefixlen_options(self):
arglist = [
@ -163,7 +163,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'name': self._subnet_pool.name,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_len_negative(self):
arglist = [
@ -201,7 +201,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'name': self._subnet_pool.name,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_address_scope_option(self):
arglist = [
@ -224,7 +224,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'name': self._subnet_pool.name,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_default_and_shared_options(self):
arglist = [
@ -250,7 +250,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'shared': True,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_description(self):
arglist = [
@ -273,7 +273,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'description': self._subnet_pool.description,
})
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_create_with_default_quota(self):
arglist = [
@ -294,7 +294,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'default_quota': 10,
})
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 = [
@ -328,7 +328,7 @@ class TestCreateSubnetPool(TestSubnetPool):
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)
@ -476,7 +476,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_long(self):
arglist = [
@ -491,7 +491,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.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_subnet_pool_list_no_share(self):
arglist = [
@ -507,7 +507,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_share(self):
arglist = [
@ -523,7 +523,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_no_default(self):
arglist = [
@ -539,7 +539,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_default(self):
arglist = [
@ -555,7 +555,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_project(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -573,7 +573,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_project_domain(self):
project = identity_fakes_v3.FakeProject.create_one_project()
@ -593,7 +593,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_name(self):
subnet_pool = network_fakes.FakeSubnetPool.create_one_subnet_pool()
@ -611,7 +611,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_subnet_pool_list_address_scope(self):
addr_scope = network_fakes.FakeAddressScope.create_one_address_scope()
@ -629,7 +629,7 @@ class TestListSubnetPool(TestSubnetPool):
self.network.subnet_pools.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_with_tag_options(self):
arglist = [
@ -654,7 +654,7 @@ class TestListSubnetPool(TestSubnetPool):
'not_any_tags': 'black,white'}
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
class TestSetSubnetPool(TestSubnetPool):
@ -1008,7 +1008,7 @@ class TestShowSubnetPool(TestSubnetPool):
ignore_missing=False
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestUnsetSubnetPool(TestSubnetPool):

View File

@ -17,7 +17,6 @@
from io import StringIO
import os
from cliff import columns as cliff_columns
import fixtures
import testtools
@ -85,18 +84,3 @@ class TestCommand(TestCase):
self.assertIn(attr, parsed_args)
self.assertEqual(value, getattr(parsed_args, attr))
return parsed_args
def assertListItemEqual(self, expected, actual):
self.assertEqual(len(expected), len(actual))
for item_expected, item_actual in zip(expected, actual):
self.assertItemEqual(item_expected, item_actual)
def assertItemEqual(self, expected, actual):
self.assertEqual(len(expected), len(actual))
for col_expected, col_actual in zip(expected, actual):
if isinstance(col_expected, cliff_columns.FormattableColumn):
self.assertIsInstance(col_actual, col_expected.__class__)
self.assertEqual(col_expected.human_readable(),
col_actual.human_readable())
else:
self.assertEqual(col_expected, col_actual)

View File

@ -109,7 +109,7 @@ class TestQosCreate(TestQos):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_qos_create_with_consumer(self):
arglist = [
@ -129,7 +129,7 @@ class TestQosCreate(TestQos):
{'consumer': self.new_qos_spec.consumer}
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_qos_create_with_properties(self):
arglist = [
@ -155,7 +155,7 @@ class TestQosCreate(TestQos):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
class TestQosDelete(TestQos):
@ -350,7 +350,7 @@ class TestQosList(TestQos):
self.qos_mock.list.assert_called_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_qos_list_no_association(self):
self.qos_mock.reset_mock()
@ -377,7 +377,7 @@ class TestQosList(TestQos):
format_columns.ListColumn(None),
format_columns.DictColumn(self.qos_specs[1].specs),
)
self.assertListItemEqual(ex_data, list(data))
self.assertItemsEqual(ex_data, list(data))
class TestQosSet(TestQos):
@ -454,7 +454,7 @@ class TestQosShow(TestQos):
self.qos_spec.name,
format_columns.DictColumn(self.qos_spec.specs),
)
self.assertItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
class TestQosUnset(TestQos):

View File

@ -78,7 +78,7 @@ class TestTypeCreate(TestType):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_type_create_with_encryption(self):
encryption_info = {
@ -139,7 +139,7 @@ class TestTypeCreate(TestType):
body,
)
self.assertEqual(encryption_columns, columns)
self.assertItemEqual(encryption_data, data)
self.assertItemsEqual(encryption_data, data)
class TestTypeDelete(TestType):
@ -270,7 +270,7 @@ class TestTypeList(TestType):
columns, data = self.cmd.take_action(parsed_args)
self.types_mock.list.assert_called_once_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_type_list_with_options(self):
arglist = [
@ -284,7 +284,7 @@ class TestTypeList(TestType):
columns, data = self.cmd.take_action(parsed_args)
self.types_mock.list.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_type_list_with_encryption(self):
encryption_type = volume_fakes.FakeType.create_one_encryption_type(
@ -328,7 +328,7 @@ class TestTypeList(TestType):
self.encryption_types_mock.list.assert_called_once_with()
self.types_mock.list.assert_called_once_with()
self.assertEqual(encryption_columns, columns)
self.assertListItemEqual(encryption_data, list(data))
self.assertItemsEqual(encryption_data, list(data))
class TestTypeSet(TestType):
@ -469,7 +469,7 @@ class TestTypeShow(TestType):
self.types_mock.get.assert_called_with(self.volume_type.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_type_show_with_encryption(self):
encryption_type = volume_fakes.FakeType.create_one_encryption_type()
@ -513,7 +513,7 @@ class TestTypeShow(TestType):
self.types_mock.get.assert_called_with(self.volume_type.id)
self.encryption_types_mock.get.assert_called_with(self.volume_type.id)
self.assertEqual(encryption_columns, columns)
self.assertItemEqual(encryption_data, data)
self.assertItemsEqual(encryption_data, data)
class TestTypeUnset(TestType):

View File

@ -135,7 +135,7 @@ class TestVolumeCreate(TestVolume):
None,
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_options(self):
arglist = [
@ -179,7 +179,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_user_project_id(self):
# Return a project
@ -226,7 +226,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_user_project_name(self):
# Return a project
@ -273,7 +273,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_properties(self):
arglist = [
@ -314,7 +314,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_image_id(self):
image = image_fakes.FakeImage.create_one_image()
@ -357,7 +357,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_image_name(self):
image = image_fakes.FakeImage.create_one_image()
@ -400,7 +400,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_with_source(self):
self.volumes_mock.get.return_value = self.new_volume
@ -430,7 +430,7 @@ class TestVolumeCreate(TestVolume):
None,
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_with_bootable_and_readonly(self):
arglist = [
@ -468,7 +468,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
self.volumes_mock.set_bootable.assert_called_with(
self.new_volume.id, True)
self.volumes_mock.update_readonly_flag.assert_called_with(
@ -510,7 +510,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
self.volumes_mock.set_bootable.assert_called_with(
self.new_volume.id, False)
self.volumes_mock.update_readonly_flag.assert_called_with(
@ -562,7 +562,7 @@ class TestVolumeCreate(TestVolume):
self.assertEqual(2, mock_error.call_count)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
self.volumes_mock.set_bootable.assert_called_with(
self.new_volume.id, True)
self.volumes_mock.update_readonly_flag.assert_called_with(
@ -765,7 +765,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_volume_list_name(self):
arglist = [
@ -782,7 +782,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, tuple(columns))
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_volume_list_status(self):
arglist = [
@ -799,7 +799,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, tuple(columns))
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_volume_list_all_projects(self):
arglist = [
@ -816,7 +816,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, tuple(columns))
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_volume_list_long(self):
arglist = [
@ -856,7 +856,7 @@ class TestVolumeList(TestVolume):
volume.AttachmentsColumn(self._volume.attachments),
format_columns.DictColumn(self._volume.metadata),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_with_limit(self):
arglist = [
@ -881,7 +881,7 @@ class TestVolumeList(TestVolume):
'all_tenants': False, }
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.datalist, tuple(data))
self.assertItemsEqual(self.datalist, tuple(data))
def test_volume_list_negative_limit(self):
arglist = [
@ -1272,7 +1272,7 @@ class TestVolumeShow(TestVolume):
self.volumes_mock.get.assert_called_with(self._volume.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_show_backward_compatibility(self):
arglist = [

View File

@ -100,7 +100,7 @@ class TestBackupCreate(TestBackup):
self.new_backup.description,
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_backup_create_without_name(self):
arglist = [
@ -124,7 +124,7 @@ class TestBackupCreate(TestBackup):
self.new_backup.description,
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestBackupDelete(TestBackup):
@ -277,7 +277,7 @@ class TestBackupList(TestBackup):
search_opts=search_opts,
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_backup_list_with_options(self):
arglist = [
@ -309,7 +309,7 @@ class TestBackupList(TestBackup):
search_opts=search_opts,
)
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, list(data))
self.assertItemsEqual(self.data_long, list(data))
class TestBackupRestore(TestBackup):
@ -391,4 +391,4 @@ class TestBackupShow(TestBackup):
self.backups_mock.get.assert_called_with(self.backup.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)

View File

@ -251,7 +251,7 @@ class TestConsistencyGroupCreate(TestConsistencyGroup):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_consistency_group_create_from_source(self):
arglist = [
@ -279,7 +279,7 @@ class TestConsistencyGroupCreate(TestConsistencyGroup):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_consistency_group_create_from_snapshot(self):
arglist = [
@ -307,7 +307,7 @@ class TestConsistencyGroupCreate(TestConsistencyGroup):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestConsistencyGroupDelete(TestConsistencyGroup):
@ -463,7 +463,7 @@ class TestConsistencyGroupList(TestConsistencyGroup):
self.consistencygroups_mock.list.assert_called_once_with(
detailed=True, search_opts={'all_tenants': False})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_consistency_group_list_with_all_project(self):
arglist = [
@ -480,7 +480,7 @@ class TestConsistencyGroupList(TestConsistencyGroup):
self.consistencygroups_mock.list.assert_called_once_with(
detailed=True, search_opts={'all_tenants': True})
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_consistency_group_list_with_long(self):
arglist = [
@ -497,7 +497,7 @@ class TestConsistencyGroupList(TestConsistencyGroup):
self.consistencygroups_mock.list.assert_called_once_with(
detailed=True, search_opts={'all_tenants': False})
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, list(data))
self.assertItemsEqual(self.data_long, list(data))
class TestConsistencyGroupRemoveVolume(TestConsistencyGroup):
@ -705,4 +705,4 @@ class TestConsistencyGroupShow(TestConsistencyGroup):
self.consistencygroups_mock.get.assert_called_once_with(
self.consistency_group.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)

View File

@ -112,7 +112,7 @@ class TestQosCreate(TestQos):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_qos_create_with_consumer(self):
arglist = [
@ -133,7 +133,7 @@ class TestQosCreate(TestQos):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_qos_create_with_properties(self):
arglist = [
@ -159,7 +159,7 @@ class TestQosCreate(TestQos):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
class TestQosDelete(TestQos):
@ -342,7 +342,7 @@ class TestQosList(TestQos):
self.qos_mock.list.assert_called_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_qos_list_no_association(self):
self.qos_mock.reset_mock()
@ -369,7 +369,7 @@ class TestQosList(TestQos):
format_columns.ListColumn(None),
format_columns.DictColumn(self.qos_specs[1].specs),
)
self.assertListItemEqual(ex_data, list(data))
self.assertItemsEqual(ex_data, list(data))
class TestQosSet(TestQos):
@ -449,7 +449,7 @@ class TestQosShow(TestQos):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, tuple(data))
self.assertItemsEqual(self.data, tuple(data))
class TestQosUnset(TestQos):

View File

@ -93,7 +93,7 @@ class TestTypeCreate(TestType):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_type_create_private(self):
arglist = [
@ -119,7 +119,7 @@ class TestTypeCreate(TestType):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_public_type_create_with_project(self):
arglist = [
@ -196,7 +196,7 @@ class TestTypeCreate(TestType):
body,
)
self.assertEqual(encryption_columns, columns)
self.assertItemEqual(encryption_data, data)
self.assertItemsEqual(encryption_data, data)
class TestTypeDelete(TestType):
@ -330,7 +330,7 @@ class TestTypeList(TestType):
columns, data = self.cmd.take_action(parsed_args)
self.types_mock.list.assert_called_once_with(is_public=None)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_type_list_with_options(self):
arglist = [
@ -348,7 +348,7 @@ class TestTypeList(TestType):
columns, data = self.cmd.take_action(parsed_args)
self.types_mock.list.assert_called_once_with(is_public=True)
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, list(data))
self.assertItemsEqual(self.data_long, list(data))
def test_type_list_with_private_option(self):
arglist = [
@ -365,7 +365,7 @@ class TestTypeList(TestType):
columns, data = self.cmd.take_action(parsed_args)
self.types_mock.list.assert_called_once_with(is_public=False)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_type_list_with_default_option(self):
arglist = [
@ -383,7 +383,7 @@ class TestTypeList(TestType):
columns, data = self.cmd.take_action(parsed_args)
self.types_mock.default.assert_called_once_with()
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data_with_default_type, list(data))
self.assertItemsEqual(self.data_with_default_type, list(data))
def test_type_list_with_encryption(self):
encryption_type = volume_fakes.FakeType.create_one_encryption_type(
@ -427,7 +427,7 @@ class TestTypeList(TestType):
self.encryption_types_mock.list.assert_called_once_with()
self.types_mock.list.assert_called_once_with(is_public=None)
self.assertEqual(encryption_columns, columns)
self.assertListItemEqual(encryption_data, list(data))
self.assertItemsEqual(encryption_data, list(data))
class TestTypeSet(TestType):
@ -713,7 +713,7 @@ class TestTypeShow(TestType):
self.types_mock.get.assert_called_with(self.volume_type.id)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
self.assertItemsEqual(self.data, data)
def test_type_show_with_access(self):
arglist = [
@ -746,7 +746,7 @@ class TestTypeShow(TestType):
private_type.name,
format_columns.DictColumn(private_type.extra_specs)
)
self.assertItemEqual(private_type_data, data)
self.assertItemsEqual(private_type_data, data)
def test_type_show_with_list_access_exec(self):
arglist = [
@ -778,7 +778,7 @@ class TestTypeShow(TestType):
private_type.name,
format_columns.DictColumn(private_type.extra_specs)
)
self.assertItemEqual(private_type_data, data)
self.assertItemsEqual(private_type_data, data)
def test_type_show_with_encryption(self):
encryption_type = volume_fakes.FakeType.create_one_encryption_type()
@ -824,7 +824,7 @@ class TestTypeShow(TestType):
self.types_mock.get.assert_called_with(self.volume_type.id)
self.encryption_types_mock.get.assert_called_with(self.volume_type.id)
self.assertEqual(encryption_columns, columns)
self.assertItemEqual(encryption_data, data)
self.assertItemsEqual(encryption_data, data)
class TestTypeUnset(TestType):

View File

@ -136,7 +136,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_options(self):
consistency_group = (
@ -182,7 +182,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_properties(self):
arglist = [
@ -218,7 +218,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_image_id(self):
image = image_fakes.FakeImage.create_one_image()
@ -256,7 +256,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_image_name(self):
image = image_fakes.FakeImage.create_one_image()
@ -294,7 +294,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_with_snapshot(self):
snapshot = volume_fakes.FakeSnapshot.create_one_snapshot()
@ -331,7 +331,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
def test_volume_create_with_bootable_and_readonly(self):
arglist = [
@ -369,7 +369,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
self.volumes_mock.set_bootable.assert_called_with(
self.new_volume.id, True)
self.volumes_mock.update_readonly_flag.assert_called_with(
@ -411,7 +411,7 @@ class TestVolumeCreate(TestVolume):
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
self.volumes_mock.set_bootable.assert_called_with(
self.new_volume.id, False)
self.volumes_mock.update_readonly_flag.assert_called_with(
@ -463,7 +463,7 @@ class TestVolumeCreate(TestVolume):
self.assertEqual(2, mock_error.call_count)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.datalist, data)
self.assertItemsEqual(self.datalist, data)
self.volumes_mock.set_bootable.assert_called_with(
self.new_volume.id, True)
self.volumes_mock.update_readonly_flag.assert_called_with(
@ -680,7 +680,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_project(self):
arglist = [
@ -720,7 +720,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_project_domain(self):
arglist = [
@ -762,7 +762,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_user(self):
arglist = [
@ -801,7 +801,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_user_domain(self):
arglist = [
@ -843,7 +843,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_name(self):
arglist = [
@ -883,7 +883,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_status(self):
arglist = [
@ -923,7 +923,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_all_projects(self):
arglist = [
@ -963,7 +963,7 @@ class TestVolumeList(TestVolume):
self.mock_volume.size,
volume.AttachmentsColumn(self.mock_volume.attachments),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_long(self):
arglist = [
@ -1017,7 +1017,7 @@ class TestVolumeList(TestVolume):
volume.AttachmentsColumn(self.mock_volume.attachments),
format_columns.DictColumn(self.mock_volume.metadata),
), )
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_with_marker_and_limit(self):
arglist = [
@ -1056,7 +1056,7 @@ class TestVolumeList(TestVolume):
'name': None,
'all_tenants': False, }
)
self.assertListItemEqual(datalist, tuple(data))
self.assertItemsEqual(datalist, tuple(data))
def test_volume_list_negative_limit(self):
arglist = [
@ -1450,7 +1450,7 @@ class TestVolumeShow(TestVolume):
volume_fakes.FakeVolume.get_volume_columns(self._volume),
columns)
self.assertItemEqual(
self.assertItemsEqual(
volume_fakes.FakeVolume.get_volume_data(self._volume),
data)

View File

@ -314,7 +314,7 @@ class TestBackupList(TestBackup):
limit=None,
)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
self.assertItemsEqual(self.data, list(data))
def test_backup_list_with_options(self):
arglist = [
@ -353,7 +353,7 @@ class TestBackupList(TestBackup):
limit=3,
)
self.assertEqual(self.columns_long, columns)
self.assertListItemEqual(self.data_long, list(data))
self.assertItemsEqual(self.data_long, list(data))
class TestBackupRestore(TestBackup):

View File

@ -3,10 +3,10 @@
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
cliff>=3.4.0 # Apache-2.0
cliff>=3.5.0 # Apache-2.0
iso8601>=0.1.11 # MIT
openstacksdk>=0.52.0 # Apache-2.0
osc-lib>=2.2.0 # Apache-2.0
osc-lib>=2.3.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
python-keystoneclient>=3.22.0 # Apache-2.0
python-novaclient>=15.1.0 # Apache-2.0