Best Python code snippet using tempest_python
test_server_actions.py
Source:test_server_actions.py
...214 self.assertEqual(202, resp.status)215 self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')216 @skip_because(bug="1233026")217 @attr(type='gate')218 def test_lock_unlock_server(self):219 # Lock the server,try server stop(exceptions throw),unlock it and retry220 resp, server = self.servers_client.lock_server(self.server_id)221 self.assertEqual(202, resp.status)222 resp, server = self.servers_client.get_server(self.server_id)223 self.assertEqual(200, resp.status)224 self.assertEqual(server['status'], 'ACTIVE')225 # Locked server is not allowed to be stopped by non-admin user226 self.assertRaises(exceptions.BadRequest,227 self.servers_client.stop, self.server_id)228 resp, server = self.servers_client.unlock_server(self.server_id)229 self.assertEqual(202, resp.status)230 resp, server = self.servers_client.stop(self.server_id)231 self.assertEqual(202, resp.status)232 self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')...
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!!