def create(self): sel.force_navigate('catalog_item_new', context={'provider_type': self.item_type}) sel.wait_for_element(basic_info_form.name_text) catalog = fakeobject_or_object(self.catalog, "name", "<Unassigned>") dialog = fakeobject_or_object(self.dialog, "name", "<No Dialog>") fill(basic_info_form, {'name_text': self.name, 'description_text': self.description, 'display_checkbox': self.display_in, 'select_catalog': catalog.name, 'select_dialog': dialog.name, 'select_orch_template': self.orch_template, 'select_provider': self.provider_type, 'select_config_template': self.config_template}) if self.item_type != "Orchestration" and self.item_type != "AnsibleTower": sel.click(basic_info_form.field_entry_point) dynamic_tree.click_path("Datastore", self.domain, "Service", "Provisioning", "StateMachines", "ServiceProvision_Template", "default") sel.click(basic_info_form.apply_btn) if self.catalog_name is not None and self.provisioning_data is not None: tabstrip.select_tab("Request Info") # Address BZ1321631 tabstrip.select_tab("Environment") tabstrip.select_tab("Catalog") template = template_select_form.template_table.find_row_by_cells({ 'Name': self.catalog_name, 'Provider': self.provider }) sel.click(template) request_form.fill(self.provisioning_data) sel.click(template_select_form.add_button)
def create(self): # Create has sequential forms, the first is only the provider type navigate_to(self, 'Add') # For element not found exception (To be removed) sel.sleep(5) sel.select("//select[@id='st_prov_type']", self.provider_type or self.item_type or 'Generic') sel.wait_for_element(basic_info_form.name_text) catalog = fakeobject_or_object(self.catalog, "name", "Unassigned") dialog = fakeobject_or_object(self.dialog, "name", "No Dialog") # Need to provide the (optional) provider name to the form, not the object provider_name = None provider_required_types = ['AnsibleTower', 'Orchestration'] if self.item_type in provider_required_types \ or self.provider_type in provider_required_types: provider_name = self.provider.name # For tests where orchestration template is None orch_template = None if self.orch_template: orch_template = self.orch_template.template_name fill(basic_info_form, {'name_text': self.name, 'description_text': self.description, 'display_checkbox': self.display_in, 'select_catalog': catalog.name, 'select_dialog': dialog.name, 'select_orch_template': orch_template, 'select_provider': provider_name, 'select_config_template': self.config_template}) if not (self.item_type in provider_required_types): sel.click(basic_info_form.field_entry_point) if version.current_version() < "5.7": dynamic_tree.click_path("Datastore", self.domain, "Service", "Provisioning", "StateMachines", "ServiceProvision_Template", "default") else: entry_tree.click_path("Datastore", self.domain, "Service", "Provisioning", "StateMachines", "ServiceProvision_Template", "default") sel.click(basic_info_form.apply_btn) if version.current_version() >= "5.7" and self.item_type == "AnsibleTower": sel.click(basic_info_form.retirement_entry_point) entry_tree.click_path("Datastore", self.domain, "Service", "Retirement", "StateMachines", "ServiceRetirement", "Generic") sel.click(basic_info_form.apply_btn) if self.catalog_name is not None \ and self.provisioning_data is not None \ and not isinstance(self.provider, NoneType): tabstrip.select_tab("Request Info") tabstrip.select_tab("Catalog") template = template_select_form.template_table.find_row_by_cells({ 'Name': self.catalog_name, 'Provider': self.provider.name }) sel.click(template) request_form.fill(self.provisioning_data) sel.click(template_select_form.add_button)
def update(self, updates): catalog = fakeobject_or_object(self.catalog, "name", "<Unassigned>") sel.force_navigate('catalog_item_edit', context={'catalog': catalog.name, 'catalog_item': self}) fill(basic_info_form, {'name_text': updates.get('name', None), 'description_text': updates.get('description', None)}, action=basic_info_form.edit_button) flash.assert_success_message('Service Catalog Item "{}" was saved'.format(self.name))
def create(self): # Create has sequential forms, the first is only the provider type navigate_to(self, 'Add') sel.select("//select[@id='st_prov_type']", self.provider_type or self.item_type or 'Generic') sel.wait_for_element(basic_info_form.name_text) catalog = fakeobject_or_object(self.catalog, "name", "Unassigned") dialog = fakeobject_or_object(self.dialog, "name", "No Dialog") fill(basic_info_form, {'name_text': self.name, 'description_text': self.description, 'display_checkbox': self.display_in, 'select_catalog': catalog.name, 'select_dialog': dialog.name, 'select_orch_template': self.orch_template, 'select_provider': self.provider_type, 'select_config_template': self.config_template}) if sel.text(basic_info_form.field_entry_point) == "": sel.click(basic_info_form.field_entry_point) if version.current_version() < "5.7": dynamic_tree.click_path("Datastore", self.domain, "Service", "Provisioning", "StateMachines", "ServiceProvision_Template", "default") else: entry_tree.click_path("Datastore", self.domain, "Service", "Provisioning", "StateMachines", "ServiceProvision_Template", "default") sel.click(basic_info_form.apply_btn) if self.catalog_name is not None and self.provisioning_data is not None: tabstrip.select_tab("Request Info") # Address BZ1321631 tabstrip.select_tab("Environment") tabstrip.select_tab("Catalog") template = template_select_form.template_table.find_row_by_cells({ 'Name': self.catalog_name, # HACK to workaround BZ1390209 # revert back to Provider once it's fixed 'Deprecated' if BZ(1390209, forced_streams=["5.7", "upstream"]).blocks else 'Provider': self.provider }) sel.click(template) request_form.fill(self.provisioning_data) sel.click(template_select_form.add_button)