Best Python code snippet using tempest_python
test_hosts.py
Source:test_hosts.py
...38 # and it will return all the hosts list39 hosts = self.client.list_hosts(zone='')['hosts']40 self.assertNotEqual(0, len(hosts))41 @test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')42 def test_list_hosts_with_nonexistent_zone(self):43 # If send the request with a nonexistent zone, the request will be44 # successful and no hosts will be retured45 hosts = self.client.list_hosts(zone='xxx')['hosts']46 self.assertEqual(0, len(hosts))47 @test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')48 def test_show_host_detail(self):49 hosts = self.client.list_hosts()['hosts']50 hosts = [host for host in hosts if host['service'] == 'compute']51 self.assertTrue(len(hosts) >= 1)52 for host in hosts:53 hostname = host['host_name']54 resources = self.client.show_host(hostname)['host']55 self.assertTrue(len(resources) >= 1)56 host_resource = resources[0]['resource']...
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!!