Add test_volumes_list functions in test_volumes_list.py.
This patch has added two test functions which includes
test_volumes_list_by_bootable
test_volumes_list_details_by_bootable
in test_volumes_list.py and matching with the corresponding
explanation docs.
Change-Id: I8259407984d47f36c03d42ec672182f3c326bdf6
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index b5ef7c0..40793ec 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -32,6 +32,11 @@
VOLUME_FIELDS = ('id', 'name')
def assertVolumesIn(self, fetched_list, expected_list, fields=None):
+ """Check out the list.
+
+ This function is aim at check out whether all of the volumes in
+ expected_list are in fetched_list.
+ """
if fields:
fieldsgetter = operator.itemgetter(*fields)
expected_list = map(fieldsgetter, expected_list)
@@ -58,7 +63,6 @@
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
cls.name = cls.VOLUME_FIELDS[1]
-
# Create 3 test volumes
cls.volume_list = []
cls.metadata = {'Type': 'work'}
@@ -146,6 +150,28 @@
self.assertEqual('available', volume['status'])
self.assertVolumesIn(fetched_list, self.volume_list)
+ @test.idempotent_id('2016a942-3020-40d7-95ce-7613bf8407ce')
+ def test_volumes_list_by_bootable(self):
+ """Check out volumes.
+
+ This test function is aim at check out whether all of the volumes
+ in volume_list are not a bootable volume.
+ """
+ params = {'bootable': 'false'}
+ fetched_list = self.client.list_volumes(params=params)['volumes']
+ self._list_by_param_value_and_assert(params)
+ self.assertVolumesIn(fetched_list, self.volume_list,
+ fields=self.VOLUME_FIELDS)
+
+ @test.idempotent_id('2016a939-72ec-482a-bf49-d5ca06216b9f')
+ def test_volumes_list_details_by_bootable(self):
+ params = {'bootable': 'false'}
+ fetched_list = self.client.list_volumes(
+ detail=True, params=params)['volumes']
+ for volume in fetched_list:
+ self.assertEqual('false', volume['bootable'])
+ self.assertVolumesIn(fetched_list, self.volume_list)
+
@test.idempotent_id('c0cfa863-3020-40d7-b587-e35f597d5d87')
def test_volumes_list_by_availability_zone(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]