How to use delete_server_metadata_item method in tempest

Best Python code snippet using tempest_python

test_server_metadata.py

Source:test_server_metadata.py Github

copy

Full Screen

...101 #Verify the meta item's value has been updated102 resp, resp_metadata = self.client.list_server_metadata(self.server_id)103 expected = {'key1': 'value1', 'key2': 'value2', 'nova': 'alt'}104 self.assertEqual(expected, resp_metadata)105 def test_delete_server_metadata_item(self):106 """The metadata value/key pair should be deleted from the server"""107 resp, meta = self.client.delete_server_metadata_item(self.server_id,108 'key1')109 self.assertEqual(204, resp.status)110 #Verify the metadata item has been removed111 resp, resp_metadata = self.client.list_server_metadata(self.server_id)112 expected = {'key2': 'value2'}113 self.assertEqual(expected, resp_metadata)114 @attr(type='negative')115 def test_get_nonexistant_server_metadata_item(self):116 """Negative test: GET on nonexistant server should not succeed"""117 try:118 resp, meta = self.client.get_server_metadata_item(999, 'test2')119 except:120 pass121 else:122 self.fail('GET on nonexistant server should not succeed')123 @attr(type='negative')124 def test_list_nonexistant_server_metadata(self):125 """126 Negative test:List metadata on a non existant server should not succeed127 """128 try:129 resp, metadata = self.client.list_server_metadata(999)130 except:131 pass132 else:133 self.fail('List metadata on a non existant server should'134 'not succeed')135 @attr(type='negative')136 def test_set_nonexistant_server_metadata(self):137 """138 Negative test: Set metadata on a non existant server should not succeed139 """140 meta = {'meta1': 'data1'}141 try:142 resp, metadata = self.client.set_server_metadata(999, meta)143 except:144 pass145 else:146 self.fail('Set metadata on a non existant server should'147 'not succeed')148 @attr(type='negative')149 def test_update_nonexistant_server_metadata(self):150 """151 Negative test: An update should not happen for a nonexistant image152 """153 meta = {'key1': 'value1', 'key2': 'value2'}154 try:155 resp, metadata = self.client.update_server_metadata(999, meta)156 except:157 pass158 else:159 self.fail('An update should not happen for a nonexistant image')160 @attr(type='negative')161 def test_delete_nonexistant_server_metadata_item(self):162 """163 Negative test: Should not be able to delete metadata item from a164 nonexistant server165 """166 meta = {'d': 'delvalue'}167 #Delete the metadata item168 try:169 resp, metadata = self.client.delete_server_metadata_item(999, 'd')170 except:171 pass172 else:...

Full Screen

Full Screen

test_server_metadata_rbac.py

Source:test_server_metadata_rbac.py Github

copy

Full Screen

...69 @decorators.idempotent_id('feec5064-678d-40bc-a88f-c856e18d1e31')70 @rbac_rule_validation.action(71 service="nova",72 rules=["os_compute_api:server-metadata:delete"])73 def test_delete_server_metadata_item(self):74 with self.override_role():75 self.servers_client.delete_server_metadata_item(...

Full Screen

Full Screen

test_servers_metadata_negative.py

Source:test_servers_metadata_negative.py Github

copy

Full Screen

...23 cls.resources.add(cls.server.id, cls.servers_client.delete_server)24 @tags(type='negative', net='no')25 def test_delete_nonexistent_server_metadata_item(self):26 with self.assertRaises(ItemNotFound):27 self.servers_client.delete_server_metadata_item(28 self.server.id, 'meta_key_5')29 @tags(type='negative', net='no')30 def test_get_nonexistent_server_metadata_item(self):31 with self.assertRaises(ItemNotFound):32 self.servers_client.get_server_metadata_item(33 self.server.id, 'meta_key_5')34 @tags(type='negative', net='no')35 def test_set_blank_metadata_dict(self):36 blank_meta = {'': ''}37 with self.assertRaises(BadRequest):38 self.servers_client.create_server(39 rand_name('testserver'), self.image_ref,40 self.flavor_ref, metadata=blank_meta)41 @tags(type='negative', net='no')42 def test_server_metadata_item_nonexistent_server(self):43 """Negative test: GET on nonexistent server should not succeed"""44 with self.assertRaises(ItemNotFound):45 self.servers_client.get_server_metadata_item(999, 'test2')46 @tags(type='negative', net='no')47 def test_list_server_metadata_nonexistent_server(self):48 """List metadata on a non existent server should not succeed"""49 with self.assertRaises(ItemNotFound):50 self.servers_client.list_server_metadata(999)51 @tags(type='negative', net='no')52 def test_set_server_metadata_nonexistent_server(self):53 """Set metadata on a non existent server should not succeed"""54 meta = {'meta1': 'data1'}55 with self.assertRaises(ItemNotFound):56 self.servers_client.set_server_metadata(999, meta)57 @tags(type='negative', net='no')58 def test_update_server_metadata_nonexistent_server(self):59 """An update should not happen for a non existent image"""60 meta = {'key1': 'value1', 'key2': 'value2'}61 with self.assertRaises(ItemNotFound):62 self.servers_client.update_server_metadata(999, meta)63 @tags(type='negative', net='no')64 def test_delete_server_metadata_item_nonexistent_server(self):65 """Deleting a metadata item from a non existent server should fail"""66 with self.assertRaises(ItemNotFound):...

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