How to use _delete_snapshot method in tempest

Best Python code snippet using tempest_python

test_volumes.py

Source:test_volumes.py Github

copy

Full Screen

...126 scenario._delete_volume = mock.MagicMock()127 scenario.create_from_volume_and_delete_volume(vol_size)128 scenario._create_volume.assert_called_once_with(1, source_volid="uuid")129 scenario._delete_volume.assert_called_once_with(fake_volume)130 def test_create_and_delete_snapshot(self):131 fake_snapshot = mock.MagicMock()132 scenario = volumes.CinderVolumes(self._get_context())133 scenario._create_snapshot = mock.MagicMock(return_value=fake_snapshot)134 scenario.sleep_between = mock.MagicMock()135 scenario._delete_snapshot = mock.MagicMock()136 scenario.create_and_delete_snapshot(False, 10, 20, fakearg="f")137 scenario._create_snapshot.assert_called_once_with("uuid", force=False,138 fakearg="f")139 scenario.sleep_between.assert_called_once_with(10, 20)140 scenario._delete_snapshot.assert_called_once_with(fake_snapshot)141 def test_create_and_list_snapshots(self):142 fake_snapshot = mock.MagicMock()143 scenario = volumes.CinderVolumes(self._get_context())144 scenario._create_snapshot = mock.MagicMock(return_value=fake_snapshot)145 scenario._list_snapshots = mock.MagicMock()146 scenario.create_and_list_snapshots(False, True, fakearg="f")147 scenario._create_snapshot.assert_called_once_with("uuid", force=False,148 fakearg="f")149 scenario._list_snapshots.assert_called_once_with(True)150 def test_create_and_attach_volume(self):...

Full Screen

Full Screen

test_volume_rbac.py

Source:test_volume_rbac.py Github

copy

Full Screen

...28 @classmethod29 def resource_setup(cls):30 super(VolumeRbacTest, cls).resource_setup()31 cls.volume = cls.create_volume()32 def _delete_snapshot(self, snapshot_id):33 waiters.wait_for_volume_resource_status(34 self.os_admin.snapshots_extensions_client, snapshot_id,35 'available')36 self.snapshots_extensions_client.delete_snapshot(snapshot_id)37 self.os_admin.snapshots_extensions_client.wait_for_resource_deletion(38 snapshot_id)39 @decorators.idempotent_id('2402013e-a624-43e3-9518-44a5d1dbb32d')40 @rbac_rule_validation.action(41 service="nova",42 rule="os_compute_api:os-volumes")43 def test_create_volume(self):44 self.rbac_utils.switch_role(self, toggle_rbac_role=True)45 volume = self.volumes_extensions_client.create_volume(46 size=CONF.volume.volume_size)['volume']47 # Use the admin volumes client to wait, because waiting involves48 # calling show API action which enforces a different policy.49 waiters.wait_for_volume_resource_status(self.os_admin.volumes_client,50 volume['id'], 'available')51 # Use non-deprecated volumes_client for deletion.52 self.addCleanup(self.volumes_client.delete_volume, volume['id'])53 @decorators.idempotent_id('69b3888c-dff2-47b0-9fa4-0672619c9054')54 @rbac_rule_validation.action(55 service="nova",56 rule="os_compute_api:os-volumes")57 def test_list_volumes(self):58 self.rbac_utils.switch_role(self, toggle_rbac_role=True)59 self.volumes_extensions_client.list_volumes()60 @decorators.idempotent_id('4ba0a820-040f-488b-86bb-be2e920ea12c')61 @rbac_rule_validation.action(62 service="nova",63 rule="os_compute_api:os-volumes")64 def test_show_volume(self):65 self.rbac_utils.switch_role(self, toggle_rbac_role=True)66 self.volumes_extensions_client.show_volume(self.volume['id'])67 @decorators.idempotent_id('6e7870f2-1bb2-4b58-96f8-6782071ef327')68 @rbac_rule_validation.action(69 service="nova",70 rule="os_compute_api:os-volumes")71 def test_delete_volume(self):72 volume = self.create_volume()73 self.rbac_utils.switch_role(self, toggle_rbac_role=True)74 self.volumes_extensions_client.delete_volume(volume['id'])75 @decorators.idempotent_id('0c3eaa4f-69d6-4a13-9dda-19585f36b1c1')76 @rbac_rule_validation.action(77 service="nova",78 rule="os_compute_api:os-volumes")79 def test_create_snapshot(self):80 self.rbac_utils.switch_role(self, toggle_rbac_role=True)81 snapshot = self.snapshots_extensions_client.create_snapshot(82 self.volume['id'])['snapshot']83 self.addCleanup(test_utils.call_and_ignore_notfound_exc,84 self._delete_snapshot, snapshot['id'])85 @decorators.idempotent_id('e944e816-416c-11e7-a919-92ebcb67fe33')86 @rbac_rule_validation.action(87 service="nova",88 rule="os_compute_api:os-volumes")89 def test_list_snapshots(self):90 self.rbac_utils.switch_role(self, toggle_rbac_role=True)91 self.snapshots_extensions_client.list_snapshots()92 @decorators.idempotent_id('19c2e6bd-585b-472f-a8d7-71ea9299c655')93 @rbac_rule_validation.action(94 service="nova",95 rule="os_compute_api:os-volumes")96 def test_show_snapshot(self):97 snapshot = self.snapshots_extensions_client.create_snapshot(98 self.volume['id'])['snapshot']99 self.addCleanup(self._delete_snapshot, snapshot['id'])100 self.rbac_utils.switch_role(self, toggle_rbac_role=True)101 self.snapshots_extensions_client.show_snapshot(snapshot['id'])102 @decorators.idempotent_id('f4f5635c-416c-11e7-a919-92ebcb67fe33')103 @rbac_rule_validation.action(104 service="nova",105 rule="os_compute_api:os-volumes")106 def test_delete_snapshot(self):107 snapshot = self.snapshots_extensions_client.create_snapshot(108 self.volume['id'])['snapshot']109 self.addCleanup(test_utils.call_and_ignore_notfound_exc,110 self._delete_snapshot, snapshot['id'])111 self.rbac_utils.switch_role(self, toggle_rbac_role=True)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful