Best Python code snippet using tempest_python
test_server_group.py
Source:test_server_group.py
...44 body = self.create_test_server_group(name, policy)45 for key in ['name', 'policies']:46 self.assertEqual(server_group[key], body[key])47 return body48 def _delete_server_group(self, server_group):49 # delete the test server-group50 self.client.delete_server_group(server_group['id'])51 # validation of server-group deletion52 server_group_list = self.client.list_server_groups()['server_groups']53 self.assertNotIn(server_group, server_group_list)54 def _create_delete_server_group(self, policy):55 # Create and Delete the server-group with given policy56 name = data_utils.rand_name('server-group')57 server_group = self._create_server_group(name, policy)58 self._delete_server_group(server_group)59 @decorators.idempotent_id('5dc57eda-35b7-4af7-9e5f-3c2be3d2d68b')60 def test_create_delete_server_group_with_affinity_policy(self):61 # Create and Delete the server-group with affinity policy62 self._create_delete_server_group(self.policy)63 @decorators.idempotent_id('3645a102-372f-4140-afad-13698d850d23')64 def test_create_delete_server_group_with_anti_affinity_policy(self):65 # Create and Delete the server-group with anti-affinity policy66 policy = ['anti-affinity']67 self._create_delete_server_group(policy)68 @decorators.idempotent_id('154dc5a4-a2fe-44b5-b99e-f15806a4a113')69 def test_create_delete_multiple_server_groups_with_same_name_policy(self):70 # Create and Delete the server-groups with same name and same policy71 server_groups = []72 server_group_name = data_utils.rand_name('server-group')73 for _ in range(0, 2):74 server_groups.append(self._create_server_group(server_group_name,75 self.policy))76 for key in ['name', 'policies']:77 self.assertEqual(server_groups[0][key], server_groups[1][key])78 self.assertNotEqual(server_groups[0]['id'], server_groups[1]['id'])79 for i in range(0, 2):80 self._delete_server_group(server_groups[i])81 @decorators.idempotent_id('b3545034-dd78-48f0-bdc2-a4adfa6d0ead')82 def test_show_server_group(self):83 # Get the server-group84 body = self.client.show_server_group(85 self.created_server_group['id'])['server_group']86 self.assertEqual(self.created_server_group, body)87 @decorators.idempotent_id('d4874179-27b4-4d7d-80e4-6c560cdfe321')88 def test_list_server_groups(self):89 # List the server-group90 body = self.client.list_server_groups()['server_groups']...
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!!