Best Python code snippet using tempest_python
servergroupspage.py
Source:servergroupspage.py
...14 time.sleep(5)15 self.wait_till_spinner_disappears()16 return ServerGroupsForm(self.driver, field_mappings=self.CREATE_SERVER_GROUP_FORM_FIELDS)17 @tables.bind_table_action('btn-danger', attribute_search='class')18 def delete_server_group(self, delete_button):19 delete_button.click()20 return forms.BaseFormRegion(self.driver)21 @tables.bind_table_action('delete')22 def delete_server_group_by_row(self, delete_button, row):23 delete_button.click()24 return forms.BaseFormRegion(self.driver)25 def _table_locator(self, table_name):26 return by.By.CSS_SELECTOR, 'hz-resource-table[resource-type-name="%s"]' % table_name27class ServerGroupsPage(basepage.BasePage):28 PARTIAL_URL = 'project/server_groups'29 GROUP_TABLE_NAME_COLUMN = 'Name'30 @property31 def server_groups_table(self):32 return ServerGroupsTable(self.driver)33 def _get_row_with_server_group_name(self, name):34 return self.server_groups_table.get_row(self.GROUP_TABLE_NAME_COLUMN, name)35 def create_server_group(self, name, policy=None, is_best_effort=False, group_size=None):36 create_form = self.server_groups_table.create_server_group()37 create_form.name.text = name38 if policy is not None:39 create_form.policy.value = policy40 if is_best_effort:41 create_form.is_best_effort.mark()42 if group_size is not None:43 create_form.group_size.text = group_size44 create_form.submit()45 def delete_server_group(self, name):46 row = self._get_row_with_server_group_name(name)47 row.mark()48 confirm_delete_form = self.server_groups_table.delete_server_group()49 confirm_delete_form.submit()50 def delete_server_group_by_row(self, name):51 row = self._get_row_with_server_group_name(name)52 confirm_delete_form = self.server_groups_table.delete_server_group_by_row(row)53 confirm_delete_form.submit()54 def is_server_group_present(self, name):55 return bool(self._get_row_with_server_group_name(name))56 def get_server_group_info(self, name, header):57 row = self._get_row_with_server_group_name(name)...
server_group.py
Source:server_group.py
...16 attrs = {"name": name, "policies": policies}17 server_group = conn.compute.create_server_group(**attrs)18 return server_group19# delete server group20def delete_server_group(server_group):21 conn.compute.delete_server_group(server_group)22# find server group_id or name23def find_server_group(server_group):24 server_group = conn.compute.find_server_group(server_group)25 print(server_group)26# get server group 27def get_server_group(server_group):28 server_group = conn.compute.get_server_group(server_group)29 print(server_group)30if __name__ == "__main__":31 name = "server_group_name"32 policies = ['anti-affinity']33 server_group = create_server_group(name, policies)34 find_server_group(server_group.name)35 get_server_group(server_group)...
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!!