Best Python code snippet using tempest_python
test_instance_actions.py
Source:test_instance_actions.py
...25 resp, server = cls.create_server(wait_until='ACTIVE')26 cls.request_id = resp['x-compute-request-id']27 cls.server_id = server['id']28 @attr(type='gate')29 def test_list_instance_actions(self):30 # List actions of the provided server31 resp, body = self.client.reboot(self.server_id, 'HARD')32 self.client.wait_for_server_status(self.server_id, 'ACTIVE')33 resp, body = self.client.list_instance_actions(self.server_id)34 self.assertEqual(200, resp.status)35 self.assertTrue(len(body) == 2)36 self.assertTrue(any([i for i in body if i['action'] == 'create']))37 self.assertTrue(any([i for i in body if i['action'] == 'reboot']))38 @attr(type='gate')39 def test_get_instance_action(self):40 # Get the action details of the provided server41 resp, body = self.client.get_instance_action(self.server_id,42 self.request_id)43 self.assertEqual(200, resp.status)44 self.assertEqual(self.server_id, body['instance_uuid'])45 self.assertEqual('create', body['action'])46 @attr(type=['negative', 'gate'])47 def test_list_instance_actions_invalid_server(self):...
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!!