Best Python code snippet using tempest_python
test_servers.py
Source:test_servers.py
...57 self.assertEqual('202', resp['status'])58 self.client.wait_for_server_status(server['id'], 'ACTIVE')59 resp, server = self.client.get_server(server['id'])60 self.assertEqual(key_name, server['key_name'])61 def _update_server_name(self, server_id, status):62 # The server name should be changed to the the provided value63 new_name = data_utils.rand_name('server')64 # Update the server with a new name65 resp, server = self.client.update_server(server_id,66 name=new_name)67 self.client.wait_for_server_status(server_id, status)68 # Verify the name of the server has changed69 resp, server = self.client.get_server(server_id)70 self.assertEqual(new_name, server['name'])71 return server72 @test.attr(type='gate')73 def test_update_server_name(self):74 # The server name should be changed to the the provided value75 resp, server = self.create_test_server(wait_until='ACTIVE')76 self._update_server_name(server['id'], 'ACTIVE')77 @test.attr(type='gate')78 def test_update_server_name_in_stop_state(self):79 # The server name should be changed to the the provided value80 resp, server = self.create_test_server(wait_until='ACTIVE')81 self.client.stop(server['id'])82 self.client.wait_for_server_status(server['id'], 'SHUTOFF')83 updated_server = self._update_server_name(server['id'], 'SHUTOFF')84 self.assertNotIn('progress', updated_server)85 @test.attr(type='gate')86 def test_update_access_server_address(self):87 # The server's access addresses should reflect the provided values88 resp, server = self.create_test_server(wait_until='ACTIVE')89 # Update the IPv4 and IPv6 access addresses90 resp, body = self.client.update_server(server['id'],91 accessIPv4='1.1.1.1',92 accessIPv6='::babe:202:202')93 self.assertEqual(200, resp.status)94 self.client.wait_for_server_status(server['id'], 'ACTIVE')95 # Verify the access addresses have been updated96 resp, server = self.client.get_server(server['id'])97 self.assertEqual('1.1.1.1', server['accessIPv4'])...
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!!