How to use create_snapshot_metadata method in tempest

Best Python code snippet using tempest_python

test_snapshot_metadata.py

Source:test_snapshot_metadata.py Github

copy

Full Screen

...35 "key2": "value2",36 "key3": "value3"}37 expected = {"key2": "value2",38 "key3": "value3"}39 _, body = self.client.create_snapshot_metadata(self.snapshot_id,40 metadata)41 # Get the metadata of the snapshot42 _, body = self.client.get_snapshot_metadata(self.snapshot_id)43 self.assertEqual(metadata, body)44 # Delete one item metadata of the snapshot45 self.client.delete_snapshot_metadata_item(46 self.snapshot_id, "key1")47 _, body = self.client.get_snapshot_metadata(self.snapshot_id)48 self.assertEqual(expected, body)49 @test.attr(type='gate')50 def test_update_snapshot_metadata(self):51 # Update metadata for the snapshot52 metadata = {"key1": "value1",53 "key2": "value2",54 "key3": "value3"}55 update = {"key3": "value3_update",56 "key4": "value4"}57 # Create metadata for the snapshot58 _, body = self.client.create_snapshot_metadata(self.snapshot_id,59 metadata)60 # Get the metadata of the snapshot61 _, body = self.client.get_snapshot_metadata(self.snapshot_id)62 self.assertEqual(metadata, body)63 # Update metadata item64 _, body = self.client.update_snapshot_metadata(65 self.snapshot_id, update)66 # Get the metadata of the snapshot67 _, body = self.client.get_snapshot_metadata(self.snapshot_id)68 self.assertEqual(update, body)69 @test.attr(type='gate')70 def test_update_snapshot_metadata_item(self):71 # Update metadata item for the snapshot72 metadata = {"key1": "value1",73 "key2": "value2",74 "key3": "value3"}75 update_item = {"key3": "value3_update"}76 expect = {"key1": "value1",77 "key2": "value2",78 "key3": "value3_update"}79 # Create metadata for the snapshot80 _, body = self.client.create_snapshot_metadata(self.snapshot_id,81 metadata)82 # Get the metadata of the snapshot83 _, body = self.client.get_snapshot_metadata(self.snapshot_id)84 self.assertEqual(metadata, body)85 # Update metadata item86 _, body = self.client.update_snapshot_metadata_item(87 self.snapshot_id, "key3", update_item)88 # Get the metadata of the snapshot89 _, body = self.client.get_snapshot_metadata(self.snapshot_id)90 self.assertEqual(expect, body)91class SnapshotV1MetadataTestJSON(SnapshotV2MetadataTestJSON):...

Full Screen

Full Screen

snapshot.py

Source:snapshot.py Github

copy

Full Screen

...48def delete_snapshot():49 snapshot_id = 'xxx'50 conn.block_store.delete_snapshot(snapshot_id)51# create snapshot metadata52def create_snapshot_metadata():53 snapshot_id = 'xxx'54 data = {55 "metadata": {56 "k1": "v1"57 }58 }59 snapshot_metadata = conn.block_store.create_snapshot_metadata(snapshot_id, **data)60 print(snapshot_metadata)61# get snapshot metadata62def get_snapshot_metadata():63 snapshot_id = 'xxx'64 snapshot_metadata = conn.block_store.get_snapshot_metadata(snapshot_id, key=None)65 print(snapshot_metadata)66# update snapshot metadata67def update_snapshot_metadata():68 snapshot_id = 'xxx'69 data_all = {70 "metadata": {71 "k1": "v1_new"72 }73 }74 snapshot_metadata = conn.block_store.update_snapshot_metadata(snapshot_id, key=None, **data_all)75 print(snapshot_metadata)76# delete snapshot metadata77def delete_snapshot_metadata():78 snapshot_id = 'xxx'79 snapshot_metadata = conn.block_store.delete_snapshot_metadata(snapshot_id, key='delete_key')80 print(snapshot_metadata)81# snapshots82def snapshots():83 for index in conn.block_store.snapshots():84 print(index)85if __name__ == '__main__':86 create_snapshot()87 update_snapshot()88 get_snapshot()89 delete_snapshot()90 create_snapshot_metadata()91 get_snapshot_metadata()92 update_snapshot_metadata()93 delete_snapshot_metadata()...

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