Best Python code snippet using tempest_python
test_volume_transfers.py
Source:test_volume_transfers.py
...62 accepted_volume['user_id'])63 self.assertEqual(self.os_alt.credentials.project_id,64 accepted_volume['os-vol-tenant-attr:tenant_id'])65 @decorators.idempotent_id('ab526943-b725-4c07-b875-8e8ef87a2c30')66 def test_create_list_delete_volume_transfer(self):67 """Test creating, listing and deleting volume transfer"""68 # Create a volume first69 volume = self.create_volume()70 self.addCleanup(self.delete_volume,71 self.adm_volumes_client,72 volume['id'])73 # Create a volume transfer74 transfer_id = self.client.create_volume_transfer(75 volume_id=volume['id'])['transfer']['id']76 self.addCleanup(test_utils.call_and_ignore_notfound_exc,77 self.client.delete_volume_transfer,78 transfer_id)79 waiters.wait_for_volume_resource_status(80 self.volumes_client, volume['id'], 'awaiting-transfer')81 # List all volume transfers with details, check the detail-specific82 # elements, and look for the created transfer.83 transfers = self.client.list_volume_transfers(detail=True)['transfers']84 self.assertNotEmpty(transfers)85 volume_list = [transfer['volume_id'] for transfer in transfers]86 self.assertIn(volume['id'], volume_list,87 'Transfer not found for volume %s' % volume['id'])88 # Delete a volume transfer89 self.client.delete_volume_transfer(transfer_id)90 waiters.wait_for_volume_resource_status(91 self.volumes_client, volume['id'], 'available')92class VolumesTransfersV355Test(VolumesTransfersTest):93 """Test volume transfer for the "new" Transfers API mv 3.55"""94 volume_min_microversion = '3.55'95 volume_max_microversion = '3.56'96 @classmethod97 def setup_clients(cls):98 super(VolumesTransfersV355Test, cls).setup_clients()99 cls.client = cls.os_primary.volume_transfers_mv355_client_latest100 cls.alt_client = cls.os_alt.volume_transfers_mv355_client_latest101 @decorators.idempotent_id('9f36bb2b-619f-4507-b246-76aeb9a28851')102 def test_create_get_list_accept_volume_transfer(self):103 """Test create, get, list, accept with volume-transfers API mv 3.55"""104 super(VolumesTransfersV355Test, self). \105 test_create_get_list_accept_volume_transfer()106 @decorators.idempotent_id('af4a5b97-0859-4f31-aa3c-85b05bb63322')107 def test_create_list_delete_volume_transfer(self):108 """Test create, list, delete with volume-transfers API mv 3.55"""109 super(VolumesTransfersV355Test, self). \110 test_create_list_delete_volume_transfer()111class VolumesTransfersV357Test(VolumesTransfersV355Test):112 """Test volume transfer for the "new" Transfers API mv 3.57"""113 volume_min_microversion = '3.57'114 volume_max_microversion = 'latest'115 @decorators.idempotent_id('d746bd69-bb30-4414-9a1c-577959fac6a1')116 def test_create_get_list_accept_volume_transfer(self):117 """Test create, get, list, accept with volume-transfers API mv 3.57"""118 super(VolumesTransfersV357Test, self). \119 test_create_get_list_accept_volume_transfer()120 @decorators.idempotent_id('d4b20ec2-e1bb-4068-adcf-6c20020a8e05')121 def test_create_list_delete_volume_transfer(self):122 """Test create, list, delete with volume-transfers API mv 3.57"""123 super(VolumesTransfersV357Test, self). \...
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!!