Best Python code snippet using tempest_python
test_server_metadata.py
Source:test_server_metadata.py
...66 self.create_server,67 meta=meta)68 # no teardown - all creates should fail69 @attr(type='gate')70 def test_update_server_metadata(self):71 # The server's metadata values should be updated to the72 # provided values73 meta = {'key1': 'alt1', 'key3': 'value3'}74 resp, metadata = self.client.update_server_metadata(self.server_id,75 meta)76 self.assertEqual(200, resp.status)77 # Verify the values have been updated to the proper values78 resp, resp_metadata = self.client.list_server_metadata(self.server_id)79 expected = {'key1': 'alt1', 'key2': 'value2', 'key3': 'value3'}80 self.assertEqual(expected, resp_metadata)81 @attr(type='gate')82 def test_update_metadata_empty_body(self):83 # The original metadata should not be lost if empty metadata body is84 # passed85 meta = {}86 _, metadata = self.client.update_server_metadata(self.server_id, meta)87 resp, resp_metadata = self.client.list_server_metadata(self.server_id)88 expected = {'key1': 'value1', 'key2': 'value2'}89 self.assertEqual(expected, resp_metadata)90 @attr(type='gate')91 def test_get_server_metadata_item(self):92 # The value for a specific metadata key should be returned93 resp, meta = self.client.get_server_metadata_item(self.server_id,94 'key2')95 self.assertEqual('value2', meta['key2'])96 @attr(type='gate')97 def test_set_server_metadata_item(self):98 # The item's value should be updated to the provided value99 # Update the metadata value100 meta = {'nova': 'alt'}...
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!!