diff --git a/openstackclient/tests/volume/v1/test_qos_specs.py b/openstackclient/tests/volume/v1/test_qos_specs.py index c2e6c0afc8..7ecc8ee829 100644 --- a/openstackclient/tests/volume/v1/test_qos_specs.py +++ b/openstackclient/tests/volume/v1/test_qos_specs.py @@ -69,6 +69,18 @@ class TestQosAssociate(TestQos): class TestQosCreate(TestQos): + + columns = ( + 'consumer', + 'id', + 'name', + ) + datalist = ( + volume_fakes.qos_consumer, + volume_fakes.qos_id, + volume_fakes.qos_name + ) + def setUp(self): super(TestQosCreate, self).setUp() @@ -97,12 +109,7 @@ class TestQosCreate(TestQos): {'consumer': volume_fakes.qos_default_consumer} ) - collist = ( - 'consumer', - 'id', - 'name' - ) - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) datalist = ( volume_fakes.qos_default_consumer, volume_fakes.qos_id, @@ -133,19 +140,8 @@ class TestQosCreate(TestQos): volume_fakes.qos_name, {'consumer': volume_fakes.qos_consumer} ) - - collist = ( - 'consumer', - 'id', - 'name' - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.qos_consumer, - volume_fakes.qos_id, - volume_fakes.qos_name - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_qos_create_with_properties(self): self.qos_mock.create.return_value = fakes.FakeResource( @@ -176,17 +172,11 @@ class TestQosCreate(TestQos): specs ) - collist = ( - 'consumer', - 'id', - 'name', + columns = self.columns + ( 'specs', ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.qos_consumer, - volume_fakes.qos_id, - volume_fakes.qos_name, + self.assertEqual(columns, columns) + datalist = self.datalist + ( volume_fakes.qos_specs, ) self.assertEqual(datalist, data) diff --git a/openstackclient/tests/volume/v1/test_volume.py b/openstackclient/tests/volume/v1/test_volume.py index 70ff50de6d..33255aacc1 100644 --- a/openstackclient/tests/volume/v1/test_volume.py +++ b/openstackclient/tests/volume/v1/test_volume.py @@ -49,6 +49,29 @@ class TestVolume(volume_fakes.TestVolumev1): class TestVolumeCreate(TestVolume): + columns = ( + 'attach_status', + 'availability_zone', + 'display_description', + 'display_name', + 'id', + 'properties', + 'size', + 'status', + 'type', + ) + datalist = ( + 'detached', + volume_fakes.volume_zone, + volume_fakes.volume_description, + volume_fakes.volume_name, + volume_fakes.volume_id, + volume_fakes.volume_metadata_str, + volume_fakes.volume_size, + volume_fakes.volume_status, + volume_fakes.volume_type, + ) + def setUp(self): super(TestVolumeCreate, self).setUp() @@ -93,31 +116,8 @@ class TestVolumeCreate(TestVolume): None, None, ) - - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_options(self): arglist = [ @@ -158,30 +158,8 @@ class TestVolumeCreate(TestVolume): None, ) - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_user_project_id(self): # Return a project @@ -233,30 +211,8 @@ class TestVolumeCreate(TestVolume): None, ) - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_user_project_name(self): # Return a project @@ -308,30 +264,8 @@ class TestVolumeCreate(TestVolume): None, ) - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_properties(self): arglist = [ @@ -369,30 +303,8 @@ class TestVolumeCreate(TestVolume): None, ) - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_image_id(self): self.images_mock.get.return_value = fakes.FakeResource( @@ -435,30 +347,8 @@ class TestVolumeCreate(TestVolume): volume_fakes.image_id, ) - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_image_name(self): self.images_mock.get.return_value = fakes.FakeResource( @@ -501,34 +391,29 @@ class TestVolumeCreate(TestVolume): volume_fakes.image_id, ) - collist = ( - 'attach_status', - 'availability_zone', - 'display_description', - 'display_name', - 'id', - 'properties', - 'size', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - 'detached', - volume_fakes.volume_zone, - volume_fakes.volume_description, - volume_fakes.volume_name, - volume_fakes.volume_id, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) class TestVolumeList(TestVolume): + columns = ( + 'ID', + 'Display Name', + 'Status', + 'Size', + 'Attached to', + ) + datalist = ( + ( + volume_fakes.volume_id, + volume_fakes.volume_name, + volume_fakes.volume_status, + volume_fakes.volume_size, + '', + ), + ) + def setUp(self): super(TestVolumeList, self).setUp() @@ -555,23 +440,8 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, columns) - - datalist = (( - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_status, - volume_fakes.volume_size, - '', - ), ) - self.assertEqual(datalist, tuple(data)) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, tuple(data)) def test_volume_list_name(self): arglist = [ @@ -586,24 +456,8 @@ class TestVolumeList(TestVolume): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) - - datalist = (( - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_status, - volume_fakes.volume_size, - '', - ), ) - self.assertEqual(datalist, tuple(data)) + self.assertEqual(self.columns, tuple(columns)) + self.assertEqual(self.datalist, tuple(data)) def test_volume_list_status(self): arglist = [ @@ -618,24 +472,8 @@ class TestVolumeList(TestVolume): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) - - datalist = (( - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_status, - volume_fakes.volume_size, - '', - ), ) - self.assertEqual(datalist, tuple(data)) + self.assertEqual(self.columns, tuple(columns)) + self.assertEqual(self.datalist, tuple(data)) def test_volume_list_all_projects(self): arglist = [ @@ -650,24 +488,8 @@ class TestVolumeList(TestVolume): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, columns) - - datalist = (( - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_status, - volume_fakes.volume_size, - '', - ), ) - self.assertEqual(datalist, tuple(data)) + self.assertEqual(self.columns, tuple(columns)) + self.assertEqual(self.datalist, tuple(data)) def test_volume_list_long(self): arglist = [ diff --git a/openstackclient/tests/volume/v2/test_backup.py b/openstackclient/tests/volume/v2/test_backup.py index 7af22e8a45..dc1d78776f 100644 --- a/openstackclient/tests/volume/v2/test_backup.py +++ b/openstackclient/tests/volume/v2/test_backup.py @@ -166,6 +166,24 @@ class TestBackupRestore(TestBackup): class TestBackupList(TestBackup): + + columns = [ + 'ID', + 'Name', + 'Description', + 'Status', + 'Size', + ] + datalist = ( + ( + volume_fakes.backup_id, + volume_fakes.backup_name, + volume_fakes.backup_description, + volume_fakes.backup_status, + volume_fakes.backup_size + ), + ) + def setUp(self): super(TestBackupList, self).setUp() @@ -193,17 +211,8 @@ class TestBackupList(TestBackup): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - collist = ['ID', 'Name', 'Description', 'Status', 'Size'] - self.assertEqual(collist, columns) - - datalist = (( - volume_fakes.backup_id, - volume_fakes.backup_name, - volume_fakes.backup_description, - volume_fakes.backup_status, - volume_fakes.backup_size - ),) - self.assertEqual(datalist, tuple(data)) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, tuple(data)) def test_backup_list_with_options(self): arglist = ["--long"] @@ -212,9 +221,13 @@ class TestBackupList(TestBackup): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - collist = ['ID', 'Name', 'Description', 'Status', 'Size', - 'Availability Zone', 'Volume', 'Container'] - self.assertEqual(collist, columns) + columns = self.columns + [ + 'Availability Zone', + 'Volume', + 'Container', + ] + + self.assertEqual(columns, columns) datalist = (( volume_fakes.backup_id, diff --git a/openstackclient/tests/volume/v2/test_qos_specs.py b/openstackclient/tests/volume/v2/test_qos_specs.py index 4222ed0772..403634a33f 100644 --- a/openstackclient/tests/volume/v2/test_qos_specs.py +++ b/openstackclient/tests/volume/v2/test_qos_specs.py @@ -69,6 +69,18 @@ class TestQosAssociate(TestQos): class TestQosCreate(TestQos): + + columns = ( + 'consumer', + 'id', + 'name' + ) + datalist = ( + volume_fakes.qos_consumer, + volume_fakes.qos_id, + volume_fakes.qos_name + ) + def setUp(self): super(TestQosCreate, self).setUp() @@ -97,12 +109,7 @@ class TestQosCreate(TestQos): {'consumer': volume_fakes.qos_default_consumer} ) - collist = ( - 'consumer', - 'id', - 'name' - ) - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) datalist = ( volume_fakes.qos_default_consumer, volume_fakes.qos_id, @@ -134,18 +141,8 @@ class TestQosCreate(TestQos): {'consumer': volume_fakes.qos_consumer} ) - collist = ( - 'consumer', - 'id', - 'name' - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.qos_consumer, - volume_fakes.qos_id, - volume_fakes.qos_name - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_qos_create_with_properties(self): self.qos_mock.create.return_value = fakes.FakeResource( @@ -176,17 +173,11 @@ class TestQosCreate(TestQos): specs ) - collist = ( - 'consumer', - 'id', - 'name', + columns = self.columns + ( 'specs', ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.qos_consumer, - volume_fakes.qos_id, - volume_fakes.qos_name, + self.assertEqual(columns, columns) + datalist = self.datalist + ( volume_fakes.qos_specs, ) self.assertEqual(datalist, data) diff --git a/openstackclient/tests/volume/v2/test_snapshot.py b/openstackclient/tests/volume/v2/test_snapshot.py index 3b30d4ef20..1c1dd43789 100644 --- a/openstackclient/tests/volume/v2/test_snapshot.py +++ b/openstackclient/tests/volume/v2/test_snapshot.py @@ -202,6 +202,15 @@ class TestSnapshotUnset(TestSnapshot): class TestSnapshotList(TestSnapshot): + + columns = [ + "ID", + "Name", + "Description", + "Status", + "Size" + ] + def setUp(self): super(TestSnapshotList, self).setUp() @@ -231,8 +240,7 @@ class TestSnapshotList(TestSnapshot): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - collist = ["ID", "Name", "Description", "Status", "Size"] - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) datalist = (( volume_fakes.snapshot_id, volume_fakes.snapshot_name, @@ -249,9 +257,12 @@ class TestSnapshotList(TestSnapshot): columns, data = self.cmd.take_action(parsed_args) - collist = ["ID", "Name", "Description", "Status", "Size", "Created At", - "Volume", "Properties"] - self.assertEqual(collist, columns) + columns = self.columns + [ + "Created At", + "Volume", + "Properties" + ] + self.assertEqual(columns, columns) datalist = (( volume_fakes.snapshot_id, @@ -277,14 +288,7 @@ class TestSnapshotList(TestSnapshot): columns, data = self.cmd.take_action(parsed_args) - collist = [ - "ID", - "Name", - "Description", - "Status", - "Size" - ] - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) datalist = (( volume_fakes.snapshot_id, diff --git a/openstackclient/tests/volume/v2/test_type.py b/openstackclient/tests/volume/v2/test_type.py index c63cd1fa53..9bf6036399 100644 --- a/openstackclient/tests/volume/v2/test_type.py +++ b/openstackclient/tests/volume/v2/test_type.py @@ -44,6 +44,17 @@ class TestType(volume_fakes.TestVolume): class TestTypeCreate(TestType): + columns = ( + 'description', + 'id', + 'name', + ) + datalist = ( + volume_fakes.type_description, + volume_fakes.type_id, + volume_fakes.type_name, + ) + def setUp(self): super(TestTypeCreate, self).setUp() @@ -76,18 +87,8 @@ class TestTypeCreate(TestType): is_public=True, ) - collist = ( - 'description', - 'id', - 'name', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.type_description, - volume_fakes.type_id, - volume_fakes.type_name, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_type_create_private(self): arglist = [ @@ -110,21 +111,17 @@ class TestTypeCreate(TestType): is_public=False, ) - collist = ( - 'description', - 'id', - 'name', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.type_description, - volume_fakes.type_id, - volume_fakes.type_name, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) class TestTypeList(TestType): + + columns = [ + "ID", + "Name" + ] + def setUp(self): super(TestTypeList, self).setUp() @@ -146,8 +143,7 @@ class TestTypeList(TestType): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - collist = ["ID", "Name"] - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) datalist = (( volume_fakes.type_id, volume_fakes.type_name, @@ -160,8 +156,11 @@ class TestTypeList(TestType): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - collist = ["ID", "Name", "Description", "Properties"] - self.assertEqual(collist, columns) + columns = self.columns + [ + "Description", + "Properties" + ] + self.assertEqual(columns, columns) datalist = (( volume_fakes.type_id, volume_fakes.type_name, diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py index 50826c31aa..d61a6c1540 100644 --- a/openstackclient/tests/volume/v2/test_volume.py +++ b/openstackclient/tests/volume/v2/test_volume.py @@ -48,6 +48,32 @@ class TestVolume(volume_fakes.TestVolume): class TestVolumeCreate(TestVolume): + + columns = ( + 'attachments', + 'availability_zone', + 'description', + 'id', + 'name', + 'properties', + 'size', + 'snapshot_id', + 'status', + 'type', + ) + datalist = ( + volume_fakes.volume_attachments, + volume_fakes.volume_availability_zone, + volume_fakes.volume_description, + volume_fakes.volume_id, + volume_fakes.volume_name, + volume_fakes.volume_metadata_str, + volume_fakes.volume_size, + volume_fakes.volume_snapshot_id, + volume_fakes.volume_status, + volume_fakes.volume_type, + ) + def setUp(self): super(TestVolumeCreate, self).setUp() @@ -88,32 +114,8 @@ class TestVolumeCreate(TestVolume): source_volid=None ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_options(self): arglist = [ @@ -149,32 +151,8 @@ class TestVolumeCreate(TestVolume): source_volid=None ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_user_project_id(self): # Return a project @@ -221,32 +199,8 @@ class TestVolumeCreate(TestVolume): source_volid=None ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_user_project_name(self): # Return a project @@ -293,32 +247,8 @@ class TestVolumeCreate(TestVolume): source_volid=None ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_properties(self): arglist = [ @@ -351,32 +281,8 @@ class TestVolumeCreate(TestVolume): source_volid=None ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_image_id(self): self.images_mock.get.return_value = fakes.FakeResource( @@ -411,35 +317,11 @@ class TestVolumeCreate(TestVolume): availability_zone=None, metadata=None, imageRef=volume_fakes.image_id, - source_volid=None + source_volid=None, ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) def test_volume_create_image_name(self): self.images_mock.get.return_value = fakes.FakeResource( @@ -477,36 +359,20 @@ class TestVolumeCreate(TestVolume): source_volid=None ) - collist = ( - 'attachments', - 'availability_zone', - 'description', - 'id', - 'name', - 'properties', - 'size', - 'snapshot_id', - 'status', - 'type', - ) - self.assertEqual(collist, columns) - datalist = ( - volume_fakes.volume_attachments, - volume_fakes.volume_availability_zone, - volume_fakes.volume_description, - volume_fakes.volume_id, - volume_fakes.volume_name, - volume_fakes.volume_metadata_str, - volume_fakes.volume_size, - volume_fakes.volume_snapshot_id, - volume_fakes.volume_status, - volume_fakes.volume_type, - ) - self.assertEqual(datalist, data) + self.assertEqual(self.columns, columns) + self.assertEqual(self.datalist, data) class TestVolumeList(TestVolume): + columns = [ + 'ID', + 'Display Name', + 'Status', + 'Size', + 'Attached to', + ] + def setUp(self): super(TestVolumeList, self).setUp() @@ -549,14 +415,7 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = [ - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ] - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] @@ -584,19 +443,11 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) - datalist = (( volume_fakes.volume_id, volume_fakes.volume_name, @@ -622,19 +473,11 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) - datalist = (( volume_fakes.volume_id, volume_fakes.volume_name, @@ -658,19 +501,10 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) - + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) - datalist = (( volume_fakes.volume_id, volume_fakes.volume_name, @@ -696,19 +530,11 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) - datalist = (( volume_fakes.volume_id, volume_fakes.volume_name, @@ -732,19 +558,11 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) - datalist = (( volume_fakes.volume_id, volume_fakes.volume_name, @@ -768,14 +586,7 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = ( - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ) - self.assertEqual(collist, tuple(columns)) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] @@ -803,14 +614,7 @@ class TestVolumeList(TestVolume): columns, data = self.cmd.take_action(parsed_args) - collist = [ - 'ID', - 'Display Name', - 'Status', - 'Size', - 'Attached to', - ] - self.assertEqual(collist, columns) + self.assertEqual(self.columns, columns) server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device']