Best Python code snippet using tempest_python
test_server_metadata.py
Source:test_server_metadata.py
...84 self.server.id, 'meta_key_1')85 metadata = metadata_response.entity86 self.assertEqual(metadata.get('meta_key_1'), 'meta_value_1')87 @tags(type='positive', net='no')88 def test_set_server_metadata_item(self):89 """The value provided for the given meta item should be updated"""90 metadata_response = self.servers_client.set_server_metadata_item(91 self.server.id, 'meta_key_2', 'nova')92 metadata = metadata_response.entity93 self.assertEqual(200, metadata_response.status_code)94 self.assertEqual(metadata.get('meta_key_2'), 'nova')95 actual_metadata_response = self.servers_client.list_server_metadata(96 self.server.id)97 actual_metadata = actual_metadata_response.entity98 self.assertEqual(actual_metadata.get('meta_key_2'), 'nova')99 self.assertEqual(actual_metadata.get('meta_key_1'), 'meta_value_1')100 @tags(type='positive', net='no')101 def test_add_new_server_metadata_item(self):102 """ The metadata item should be added to the server"""103 metadata_response = self.servers_client.set_server_metadata_item(104 self.server.id, 'meta_key_3', 'meta_value_3')105 metadata = metadata_response.entity106 self.assertEqual(200, metadata_response.status_code)107 self.assertEqual(metadata.get('meta_key_3'), 'meta_value_3')108 actual_metadata_response = self.servers_client.list_server_metadata(109 self.server.id)110 actual_metadata = actual_metadata_response.entity111 self.assertEqual(actual_metadata.get('meta_key_3'), 'meta_value_3')112 self.assertEqual(actual_metadata.get('meta_key_2'), 'meta_value_2')113 self.assertEqual(actual_metadata.get('meta_key_1'), 'meta_value_1')114 @tags(type='positive', net='no')115 def test_delete_server_metadata_item(self):116 """The metadata value/key pair should be deleted from the server"""117 response = self.servers_client.delete_server_metadata_item(...
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!!