Merge "Refactor: Abstract columns and datalist out in volume test cases"

This commit is contained in:
Jenkins 2016-01-22 08:55:38 +00:00 committed by Gerrit Code Review
commit 75caafa096
7 changed files with 226 additions and 603 deletions

View File

@ -69,6 +69,18 @@ class TestQosAssociate(TestQos):
class TestQosCreate(TestQos): class TestQosCreate(TestQos):
columns = (
'consumer',
'id',
'name',
)
datalist = (
volume_fakes.qos_consumer,
volume_fakes.qos_id,
volume_fakes.qos_name
)
def setUp(self): def setUp(self):
super(TestQosCreate, self).setUp() super(TestQosCreate, self).setUp()
@ -97,12 +109,7 @@ class TestQosCreate(TestQos):
{'consumer': volume_fakes.qos_default_consumer} {'consumer': volume_fakes.qos_default_consumer}
) )
collist = ( self.assertEqual(self.columns, columns)
'consumer',
'id',
'name'
)
self.assertEqual(collist, columns)
datalist = ( datalist = (
volume_fakes.qos_default_consumer, volume_fakes.qos_default_consumer,
volume_fakes.qos_id, volume_fakes.qos_id,
@ -133,19 +140,8 @@ class TestQosCreate(TestQos):
volume_fakes.qos_name, volume_fakes.qos_name,
{'consumer': volume_fakes.qos_consumer} {'consumer': volume_fakes.qos_consumer}
) )
self.assertEqual(self.columns, columns)
collist = ( self.assertEqual(self.datalist, data)
'consumer',
'id',
'name'
)
self.assertEqual(collist, columns)
datalist = (
volume_fakes.qos_consumer,
volume_fakes.qos_id,
volume_fakes.qos_name
)
self.assertEqual(datalist, data)
def test_qos_create_with_properties(self): def test_qos_create_with_properties(self):
self.qos_mock.create.return_value = fakes.FakeResource( self.qos_mock.create.return_value = fakes.FakeResource(
@ -176,17 +172,11 @@ class TestQosCreate(TestQos):
specs specs
) )
collist = ( columns = self.columns + (
'consumer',
'id',
'name',
'specs', 'specs',
) )
self.assertEqual(collist, columns) self.assertEqual(columns, columns)
datalist = ( datalist = self.datalist + (
volume_fakes.qos_consumer,
volume_fakes.qos_id,
volume_fakes.qos_name,
volume_fakes.qos_specs, volume_fakes.qos_specs,
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)

View File

@ -49,6 +49,29 @@ class TestVolume(volume_fakes.TestVolumev1):
class TestVolumeCreate(TestVolume): 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): def setUp(self):
super(TestVolumeCreate, self).setUp() super(TestVolumeCreate, self).setUp()
@ -93,31 +116,8 @@ class TestVolumeCreate(TestVolume):
None, None,
None, None,
) )
self.assertEqual(self.columns, columns)
collist = ( self.assertEqual(self.datalist, data)
'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)
def test_volume_create_options(self): def test_volume_create_options(self):
arglist = [ arglist = [
@ -158,30 +158,8 @@ class TestVolumeCreate(TestVolume):
None, None,
) )
collist = ( self.assertEqual(self.columns, columns)
'attach_status', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_user_project_id(self): def test_volume_create_user_project_id(self):
# Return a project # Return a project
@ -233,30 +211,8 @@ class TestVolumeCreate(TestVolume):
None, None,
) )
collist = ( self.assertEqual(self.columns, columns)
'attach_status', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_user_project_name(self): def test_volume_create_user_project_name(self):
# Return a project # Return a project
@ -308,30 +264,8 @@ class TestVolumeCreate(TestVolume):
None, None,
) )
collist = ( self.assertEqual(self.columns, columns)
'attach_status', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_properties(self): def test_volume_create_properties(self):
arglist = [ arglist = [
@ -369,30 +303,8 @@ class TestVolumeCreate(TestVolume):
None, None,
) )
collist = ( self.assertEqual(self.columns, columns)
'attach_status', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_image_id(self): def test_volume_create_image_id(self):
self.images_mock.get.return_value = fakes.FakeResource( self.images_mock.get.return_value = fakes.FakeResource(
@ -435,30 +347,8 @@ class TestVolumeCreate(TestVolume):
volume_fakes.image_id, volume_fakes.image_id,
) )
collist = ( self.assertEqual(self.columns, columns)
'attach_status', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_image_name(self): def test_volume_create_image_name(self):
self.images_mock.get.return_value = fakes.FakeResource( self.images_mock.get.return_value = fakes.FakeResource(
@ -501,34 +391,29 @@ class TestVolumeCreate(TestVolume):
volume_fakes.image_id, volume_fakes.image_id,
) )
collist = ( self.assertEqual(self.columns, columns)
'attach_status', self.assertEqual(self.datalist, data)
'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)
class TestVolumeList(TestVolume): 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): def setUp(self):
super(TestVolumeList, self).setUp() super(TestVolumeList, self).setUp()
@ -555,23 +440,8 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID', self.assertEqual(self.datalist, tuple(data))
'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))
def test_volume_list_name(self): def test_volume_list_name(self):
arglist = [ arglist = [
@ -586,24 +456,8 @@ class TestVolumeList(TestVolume):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, tuple(columns))
collist = ( self.assertEqual(self.datalist, tuple(data))
'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))
def test_volume_list_status(self): def test_volume_list_status(self):
arglist = [ arglist = [
@ -618,24 +472,8 @@ class TestVolumeList(TestVolume):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, tuple(columns))
collist = ( self.assertEqual(self.datalist, tuple(data))
'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))
def test_volume_list_all_projects(self): def test_volume_list_all_projects(self):
arglist = [ arglist = [
@ -650,24 +488,8 @@ class TestVolumeList(TestVolume):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, tuple(columns))
collist = ( self.assertEqual(self.datalist, tuple(data))
'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))
def test_volume_list_long(self): def test_volume_list_long(self):
arglist = [ arglist = [

View File

@ -166,6 +166,24 @@ class TestBackupRestore(TestBackup):
class TestBackupList(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): def setUp(self):
super(TestBackupList, self).setUp() super(TestBackupList, self).setUp()
@ -193,17 +211,8 @@ class TestBackupList(TestBackup):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ['ID', 'Name', 'Description', 'Status', 'Size'] self.assertEqual(self.columns, columns)
self.assertEqual(collist, columns) self.assertEqual(self.datalist, tuple(data))
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))
def test_backup_list_with_options(self): def test_backup_list_with_options(self):
arglist = ["--long"] arglist = ["--long"]
@ -212,9 +221,13 @@ class TestBackupList(TestBackup):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ['ID', 'Name', 'Description', 'Status', 'Size', columns = self.columns + [
'Availability Zone', 'Volume', 'Container'] 'Availability Zone',
self.assertEqual(collist, columns) 'Volume',
'Container',
]
self.assertEqual(columns, columns)
datalist = (( datalist = ((
volume_fakes.backup_id, volume_fakes.backup_id,

View File

@ -69,6 +69,18 @@ class TestQosAssociate(TestQos):
class TestQosCreate(TestQos): class TestQosCreate(TestQos):
columns = (
'consumer',
'id',
'name'
)
datalist = (
volume_fakes.qos_consumer,
volume_fakes.qos_id,
volume_fakes.qos_name
)
def setUp(self): def setUp(self):
super(TestQosCreate, self).setUp() super(TestQosCreate, self).setUp()
@ -97,12 +109,7 @@ class TestQosCreate(TestQos):
{'consumer': volume_fakes.qos_default_consumer} {'consumer': volume_fakes.qos_default_consumer}
) )
collist = ( self.assertEqual(self.columns, columns)
'consumer',
'id',
'name'
)
self.assertEqual(collist, columns)
datalist = ( datalist = (
volume_fakes.qos_default_consumer, volume_fakes.qos_default_consumer,
volume_fakes.qos_id, volume_fakes.qos_id,
@ -134,18 +141,8 @@ class TestQosCreate(TestQos):
{'consumer': volume_fakes.qos_consumer} {'consumer': volume_fakes.qos_consumer}
) )
collist = ( self.assertEqual(self.columns, columns)
'consumer', self.assertEqual(self.datalist, data)
'id',
'name'
)
self.assertEqual(collist, columns)
datalist = (
volume_fakes.qos_consumer,
volume_fakes.qos_id,
volume_fakes.qos_name
)
self.assertEqual(datalist, data)
def test_qos_create_with_properties(self): def test_qos_create_with_properties(self):
self.qos_mock.create.return_value = fakes.FakeResource( self.qos_mock.create.return_value = fakes.FakeResource(
@ -176,17 +173,11 @@ class TestQosCreate(TestQos):
specs specs
) )
collist = ( columns = self.columns + (
'consumer',
'id',
'name',
'specs', 'specs',
) )
self.assertEqual(collist, columns) self.assertEqual(columns, columns)
datalist = ( datalist = self.datalist + (
volume_fakes.qos_consumer,
volume_fakes.qos_id,
volume_fakes.qos_name,
volume_fakes.qos_specs, volume_fakes.qos_specs,
) )
self.assertEqual(datalist, data) self.assertEqual(datalist, data)

View File

@ -202,6 +202,15 @@ class TestSnapshotUnset(TestSnapshot):
class TestSnapshotList(TestSnapshot): class TestSnapshotList(TestSnapshot):
columns = [
"ID",
"Name",
"Description",
"Status",
"Size"
]
def setUp(self): def setUp(self):
super(TestSnapshotList, self).setUp() super(TestSnapshotList, self).setUp()
@ -231,8 +240,7 @@ class TestSnapshotList(TestSnapshot):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ["ID", "Name", "Description", "Status", "Size"] self.assertEqual(self.columns, columns)
self.assertEqual(collist, columns)
datalist = (( datalist = ((
volume_fakes.snapshot_id, volume_fakes.snapshot_id,
volume_fakes.snapshot_name, volume_fakes.snapshot_name,
@ -249,9 +257,12 @@ class TestSnapshotList(TestSnapshot):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ["ID", "Name", "Description", "Status", "Size", "Created At", columns = self.columns + [
"Volume", "Properties"] "Created At",
self.assertEqual(collist, columns) "Volume",
"Properties"
]
self.assertEqual(columns, columns)
datalist = (( datalist = ((
volume_fakes.snapshot_id, volume_fakes.snapshot_id,
@ -277,14 +288,7 @@ class TestSnapshotList(TestSnapshot):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = [ self.assertEqual(self.columns, columns)
"ID",
"Name",
"Description",
"Status",
"Size"
]
self.assertEqual(collist, columns)
datalist = (( datalist = ((
volume_fakes.snapshot_id, volume_fakes.snapshot_id,

View File

@ -44,6 +44,17 @@ class TestType(volume_fakes.TestVolume):
class TestTypeCreate(TestType): class TestTypeCreate(TestType):
columns = (
'description',
'id',
'name',
)
datalist = (
volume_fakes.type_description,
volume_fakes.type_id,
volume_fakes.type_name,
)
def setUp(self): def setUp(self):
super(TestTypeCreate, self).setUp() super(TestTypeCreate, self).setUp()
@ -76,18 +87,8 @@ class TestTypeCreate(TestType):
is_public=True, is_public=True,
) )
collist = ( self.assertEqual(self.columns, columns)
'description', self.assertEqual(self.datalist, data)
'id',
'name',
)
self.assertEqual(collist, columns)
datalist = (
volume_fakes.type_description,
volume_fakes.type_id,
volume_fakes.type_name,
)
self.assertEqual(datalist, data)
def test_type_create_private(self): def test_type_create_private(self):
arglist = [ arglist = [
@ -110,21 +111,17 @@ class TestTypeCreate(TestType):
is_public=False, is_public=False,
) )
collist = ( self.assertEqual(self.columns, columns)
'description', self.assertEqual(self.datalist, data)
'id',
'name',
)
self.assertEqual(collist, columns)
datalist = (
volume_fakes.type_description,
volume_fakes.type_id,
volume_fakes.type_name,
)
self.assertEqual(datalist, data)
class TestTypeList(TestType): class TestTypeList(TestType):
columns = [
"ID",
"Name"
]
def setUp(self): def setUp(self):
super(TestTypeList, self).setUp() super(TestTypeList, self).setUp()
@ -146,8 +143,7 @@ class TestTypeList(TestType):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ["ID", "Name"] self.assertEqual(self.columns, columns)
self.assertEqual(collist, columns)
datalist = (( datalist = ((
volume_fakes.type_id, volume_fakes.type_id,
volume_fakes.type_name, volume_fakes.type_name,
@ -160,8 +156,11 @@ class TestTypeList(TestType):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ["ID", "Name", "Description", "Properties"] columns = self.columns + [
self.assertEqual(collist, columns) "Description",
"Properties"
]
self.assertEqual(columns, columns)
datalist = (( datalist = ((
volume_fakes.type_id, volume_fakes.type_id,
volume_fakes.type_name, volume_fakes.type_name,

View File

@ -48,6 +48,32 @@ class TestVolume(volume_fakes.TestVolume):
class TestVolumeCreate(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): def setUp(self):
super(TestVolumeCreate, self).setUp() super(TestVolumeCreate, self).setUp()
@ -88,32 +114,8 @@ class TestVolumeCreate(TestVolume):
source_volid=None source_volid=None
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_options(self): def test_volume_create_options(self):
arglist = [ arglist = [
@ -149,32 +151,8 @@ class TestVolumeCreate(TestVolume):
source_volid=None source_volid=None
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_user_project_id(self): def test_volume_create_user_project_id(self):
# Return a project # Return a project
@ -221,32 +199,8 @@ class TestVolumeCreate(TestVolume):
source_volid=None source_volid=None
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_user_project_name(self): def test_volume_create_user_project_name(self):
# Return a project # Return a project
@ -293,32 +247,8 @@ class TestVolumeCreate(TestVolume):
source_volid=None source_volid=None
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_properties(self): def test_volume_create_properties(self):
arglist = [ arglist = [
@ -351,32 +281,8 @@ class TestVolumeCreate(TestVolume):
source_volid=None source_volid=None
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_image_id(self): def test_volume_create_image_id(self):
self.images_mock.get.return_value = fakes.FakeResource( self.images_mock.get.return_value = fakes.FakeResource(
@ -411,35 +317,11 @@ class TestVolumeCreate(TestVolume):
availability_zone=None, availability_zone=None,
metadata=None, metadata=None,
imageRef=volume_fakes.image_id, imageRef=volume_fakes.image_id,
source_volid=None source_volid=None,
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
def test_volume_create_image_name(self): def test_volume_create_image_name(self):
self.images_mock.get.return_value = fakes.FakeResource( self.images_mock.get.return_value = fakes.FakeResource(
@ -477,36 +359,20 @@ class TestVolumeCreate(TestVolume):
source_volid=None source_volid=None
) )
collist = ( self.assertEqual(self.columns, columns)
'attachments', self.assertEqual(self.datalist, data)
'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)
class TestVolumeList(TestVolume): class TestVolumeList(TestVolume):
columns = [
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
]
def setUp(self): def setUp(self):
super(TestVolumeList, self).setUp() super(TestVolumeList, self).setUp()
@ -549,14 +415,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = [ self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
]
self.assertEqual(collist, columns)
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
@ -584,19 +443,11 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
)
self.assertEqual(collist, tuple(columns))
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
msg = 'Attached to %s on %s ' % (server, device) msg = 'Attached to %s on %s ' % (server, device)
datalist = (( datalist = ((
volume_fakes.volume_id, volume_fakes.volume_id,
volume_fakes.volume_name, volume_fakes.volume_name,
@ -622,19 +473,11 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
)
self.assertEqual(collist, tuple(columns))
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
msg = 'Attached to %s on %s ' % (server, device) msg = 'Attached to %s on %s ' % (server, device)
datalist = (( datalist = ((
volume_fakes.volume_id, volume_fakes.volume_id,
volume_fakes.volume_name, volume_fakes.volume_name,
@ -658,19 +501,10 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
)
self.assertEqual(collist, tuple(columns))
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
msg = 'Attached to %s on %s ' % (server, device) msg = 'Attached to %s on %s ' % (server, device)
datalist = (( datalist = ((
volume_fakes.volume_id, volume_fakes.volume_id,
volume_fakes.volume_name, volume_fakes.volume_name,
@ -696,19 +530,11 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
)
self.assertEqual(collist, tuple(columns))
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
msg = 'Attached to %s on %s ' % (server, device) msg = 'Attached to %s on %s ' % (server, device)
datalist = (( datalist = ((
volume_fakes.volume_id, volume_fakes.volume_id,
volume_fakes.volume_name, volume_fakes.volume_name,
@ -732,19 +558,11 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
)
self.assertEqual(collist, tuple(columns))
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
msg = 'Attached to %s on %s ' % (server, device) msg = 'Attached to %s on %s ' % (server, device)
datalist = (( datalist = ((
volume_fakes.volume_id, volume_fakes.volume_id,
volume_fakes.volume_name, volume_fakes.volume_name,
@ -768,14 +586,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = ( self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
)
self.assertEqual(collist, tuple(columns))
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']
@ -803,14 +614,7 @@ class TestVolumeList(TestVolume):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
collist = [ self.assertEqual(self.columns, columns)
'ID',
'Display Name',
'Status',
'Size',
'Attached to',
]
self.assertEqual(collist, columns)
server = volume_fakes.volume_attachment_server['server_id'] server = volume_fakes.volume_attachment_server['server_id']
device = volume_fakes.volume_attachment_server['device'] device = volume_fakes.volume_attachment_server['device']