Best Python code snippet using tempest_python
test_volumes_actions.py
Source:test_volumes_actions.py
...14# under the License.15from tempest.api.volume import base16from tempest.lib import decorators17class VolumesActionsV2Test(base.BaseVolumeAdminTest):18 def _create_reset_and_force_delete_temp_volume(self, status=None):19 # Create volume, reset volume status, and force delete temp volume20 temp_volume = self.create_volume()21 if status:22 self.admin_volume_client.reset_volume_status(23 temp_volume['id'], status=status)24 self.admin_volume_client.force_delete_volume(temp_volume['id'])25 self.volumes_client.wait_for_resource_deletion(temp_volume['id'])26 @decorators.idempotent_id('d063f96e-a2e0-4f34-8b8a-395c42de1845')27 def test_volume_reset_status(self):28 # test volume reset status : available->error->available29 volume = self.create_volume()30 for status in ['error', 'available']:31 self.admin_volume_client.reset_volume_status(32 volume['id'], status=status)33 volume_get = self.admin_volume_client.show_volume(34 volume['id'])['volume']35 self.assertEqual(status, volume_get['status'])36 @decorators.idempotent_id('21737d5a-92f2-46d7-b009-a0cc0ee7a570')37 def test_volume_force_delete_when_volume_is_creating(self):38 # test force delete when status of volume is creating39 self._create_reset_and_force_delete_temp_volume('creating')40 @decorators.idempotent_id('db8d607a-aa2e-4beb-b51d-d4005c232011')41 def test_volume_force_delete_when_volume_is_attaching(self):42 # test force delete when status of volume is attaching43 self._create_reset_and_force_delete_temp_volume('attaching')44 @decorators.idempotent_id('3e33a8a8-afd4-4d64-a86b-c27a185c5a4a')45 def test_volume_force_delete_when_volume_is_error(self):46 # test force delete when status of volume is error47 self._create_reset_and_force_delete_temp_volume('error')48class VolumesActionsV1Test(VolumesActionsV2Test):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!