Ejemplo n.º 1
0
def test_multiple_host_good_creds(setup_provider, provider, hosts, host_list):
    """  Tests multiple host credentialing  with good credentials """

    sel.force_navigate('infrastructure_provider',
                       context={'provider': provider})
    sel.click(details_page.infoblock.element("Relationships", "Hosts"))

    quads = Quadicon.all("host", this_page=True)
    for quad in quads:
        sel.check(quad.checkbox())
    tb.select("Configuration", config_option())

    cfme_host = random.choice(provider.get_yaml_data()["hosts"])
    cred = cfme_host['credentials']
    creds = conf.credentials[cred]
    fill(
        credential_form, {
            'default_principal': creds['username'],
            'default_secret': creds['password'],
            'default_verify_secret': creds['password'],
            'validate_host': cfme_host["name"]
        })

    sel.click(credential_form.validate_multi_host)
    flash.assert_message_match('Credential validation was successful')

    sel.click(credential_form.save_btn)
    flash.assert_message_match('Credentials/Settings saved successfully')
Ejemplo n.º 2
0
def test_multiple_host_bad_creds(setup_provider, provider):
    """    Tests multiple host credentialing with bad credentials """

    details_view = navigate_to(provider, 'Details')
    details_view.contents.relationships.click_at('Hosts')

    quads = Quadicon.all("host", this_page=True)
    for quad in quads:
        sel.check(quad.checkbox())
    tb.select("Configuration", config_option())

    cfme_host = random.choice(provider.data["hosts"])
    creds = conf.credentials['bad_credentials']
    fill(
        credential_form, {
            'default_principal': creds['username'],
            'default_secret': creds['password'],
            'default_verify_secret': creds['password'],
            'validate_host': cfme_host["name"]
        })

    sel.click(credential_form.validate_multi_host)
    flash.assert_message_match(
        'Cannot complete login due to an incorrect user name or password.')

    sel.click(credential_form.cancel_changes)
Ejemplo n.º 3
0
def test_multiple_host_bad_creds(setup_provider, provider, hosts, host_list):
    """    Tests multiple host credentialing with bad credentials """

    sel.force_navigate('infrastructure_provider',
                       context={'provider': provider})
    sel.click(details_page.infoblock.element("Relationships", "Hosts"))

    quads = Quadicon.all("host", this_page=True)
    for quad in quads:
        sel.check(quad.checkbox())
    tb.select("Configuration", config_option())

    cfme_host = random.choice(provider.get_yaml_data()["hosts"])
    creds = conf.credentials['bad_credentials']
    fill(
        credential_form, {
            'default_principal': creds['username'],
            'default_secret': creds['password'],
            'default_verify_secret': creds['password'],
            'validate_host': cfme_host["name"]
        })

    sel.click(credential_form.validate_multi_host)
    flash.assert_message_match(
        'Cannot complete login due to an incorrect user name or password.')

    sel.click(credential_form.cancel_changes)
Ejemplo n.º 4
0
def test_multiple_host_good_creds(setup_provider, provider):
    """  Tests multiple host credentialing  with good credentials """

    details_view = navigate_to(provider, 'Details')
    details_view.contents.relationships.click_at('Hosts')

    quads = Quadicon.all("host", this_page=True)
    for quad in quads:
        sel.check(quad.checkbox())
    tb.select("Configuration", config_option())

    cfme_host = random.choice(provider.data["hosts"])
    cred = cfme_host['credentials']
    creds = conf.credentials[cred]
    fill(
        credential_form, {
            'default_principal': creds['username'],
            'default_secret': creds['password'],
            'default_verify_secret': creds['password'],
            'validate_host': cfme_host["name"]
        })

    sel.click(credential_form.validate_multi_host)
    flash.assert_message_match('Credential validation was successful')

    sel.click(credential_form.save_btn)
    flash.assert_message_match('Credentials/Settings saved successfully')
Ejemplo n.º 5
0
    def find_quadicon(self, **kwargs):
        """Find and return a quadicon belonging to a specific instance

        TODO: remove this method and refactor callers to use view entities instead

        Args:
        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        """
        if not kwargs.get('do_not_navigate', False):
            navigate_to(self, 'All')

        # Make sure we're looking at the quad grid
        view = self.browser.create_view(InstanceAllView)
        view.toolbar.view_selector.select('Grid View')

        # Keeping paginator iteration here to create Quadicon object
        # using entities.get_first_entity won't give the quadicon object we need for compatibility
        for _ in view.entities.paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if quadicon.exists:
                if kwargs.get('mark', False):
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(
                self.name))
Ejemplo n.º 6
0
 def resetter(self):
     tb.refresh()
     tb.select('List View')
     # Ensure no rows are checked
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Ejemplo n.º 7
0
    def delete(self, from_dest='All'):
        """
        Delete the stack, starting from the destination provided by from_dest
        @param from_dest: where to delete from, a valid navigation destination for Stack
        """

        # Navigate to the starting destination
        if from_dest in navigator.list_destinations(self):
            navigate_to(self, from_dest)
        else:
            msg = 'cfme.cloud.stack does not have destination {}'.format(
                from_dest)
            raise DestinationNotFound(msg)

        # Delete using the method appropriate for the starting destination
        if from_dest == 'All':
            sel.check(Quadicon(self.name, self.quad_name).checkbox())
            cfg_btn("Remove Orchestration Stacks", invokes_alert=True)
        elif from_dest == 'Details':
            cfg_btn("Remove this Orchestration Stack", invokes_alert=True)

        sel.handle_alert()
        # The delete initiated message may get missed if the delete is fast
        try:
            flash.assert_message_contain(
                "Delete initiated for 1 Orchestration Stacks")
        except FlashMessageException as ex:
            if 'No flash message contains' in ex.message:
                flash.assert_message_contain(
                    "The selected Orchestration Stacks was deleted")

        self.wait_for_delete()
Ejemplo n.º 8
0
 def delete(self):
     """Remove template from CFME VMDB"""
     sel.force_navigate("clouds_images")
     quad = Quadicon(self.name, 'image')
     sel.check(quad.checkbox())
     cfg_btn('Remove selected items from the VMDB', invokes_alert=True)
     sel.handle_alert()
Ejemplo n.º 9
0
 def resetter(self):
     # Default list view
     tb.select('List View')
     if paginator.page_controls_exist():
         # Make sure nothing is selected
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Ejemplo n.º 10
0
    def delete(self, cancel=False, wait_deleted=True, force=False):
        """Deletes the manager through UI

        Args:
            cancel (bool): Whether to cancel out of the deletion, when the alert pops up.
            wait_deleted (bool): Whether we want to wait for the manager to disappear from the UI.
                True will wait; False will only delete it and move on.
            force (bool): Whether to try to delete the manager even though it doesn't exist.
                True will try to delete it anyway; False will check for its existence and leave,
                if not present.
        """
        if not force and not self.exists:
            return
        navigate_to(self, 'All')
        sel.check(Quadicon(self.quad_name, None).checkbox())
        item_text = version.pick({'5.6': 'Remove selected items from the VMDB',
                                  '5.7': 'Remove selected items'})
        cfg_btn(item_text, invokes_alert=True)

        sel.handle_alert(cancel)
        if not cancel:
            flash_msg = version.pick({'5.6': 'Delete initiated for 1 provider',
                                      '5.7': 'Delete initiated for 1 Provider'})

            flash.assert_message_match(flash_msg)
            if wait_deleted:
                wait_for(func=lambda: self.exists, fail_condition=True, delay=15, num_sec=60)
Ejemplo n.º 11
0
 def delete(self):
     sel.force_navigate("my_settings_time_profiles")
     row = timeprofile_table.find_row_by_cells({"description": self.description})
     sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
     cfg_btn("Delete selected Time Profiles", invokes_alert=True)
     sel.handle_alert()
     flash.assert_success_message('Time Profile "{}": Delete successful'.format(self.description))
Ejemplo n.º 12
0
    def _find_quadicon(self, is_vm=True, do_not_navigate=False, mark=False, refresh=True):
        """Find and return a quadicon belonging to a specific vm

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmNotFound
        """
        quadicon = Quadicon(self.name, "vm")
        if not do_not_navigate:
            if is_vm:
                self.provider_crud.load_all_provider_vms()
            else:
                self.provider_crud.load_all_provider_templates()
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if is_vm:
                raise VmNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmNotFound("VM '{}' not found in UI!".format(self.name))
Ejemplo n.º 13
0
    def delete(self, from_dest='All'):
        """
        Delete the stack, starting from the destination provided by from_dest
        @param from_dest: where to delete from, a valid navigation destination for Stack
        """

        # Navigate to the starting destination
        if from_dest in navigator.list_destinations(self):
            navigate_to(self, from_dest)
        else:
            msg = 'cfme.cloud.stack does not have destination {}'.format(from_dest)
            raise DestinationNotFound(msg)

        # Delete using the method appropriate for the starting destination
        if from_dest == 'All':
            sel.check(Quadicon(self.name, self.quad_name).checkbox())
            cfg_btn("Remove Orchestration Stacks", invokes_alert=True)
        elif from_dest == 'Details':
            cfg_btn("Remove this Orchestration Stack", invokes_alert=True)

        sel.handle_alert()
        # The delete initiated message may get missed if the delete is fast
        try:
            flash.assert_message_contain("Delete initiated for 1 Orchestration Stacks")
        except FlashMessageException as ex:
            if 'No flash message contains' in ex.message:
                flash.assert_message_contain("The selected Orchestration Stacks was deleted")

        self.wait_for_delete()
Ejemplo n.º 14
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False):
        """Find and return a quadicon belonging to a specific instance

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: InstanceNotFound
        """
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate("clouds_instances")
            elif not self.provider_crud.load_all_provider_instances():
                raise InstanceNotFound("No instances for the provider!")
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))
Ejemplo n.º 15
0
 def delete(self):
     """Remove template from CFME VMDB"""
     sel.force_navigate("clouds_images")
     quad = Quadicon(self.name, 'image')
     sel.check(quad.checkbox())
     cfg_btn('Remove selected items from the VMDB', invokes_alert=True)
     sel.handle_alert()
Ejemplo n.º 16
0
    def find_quadicon(self, **kwargs):
        """Find and return a quadicon belonging to a specific instance

        TODO: remove this method and refactor callers to use view entities instead

        Args:
        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        """
        if not kwargs.get('do_not_navigate', False):
            navigate_to(self, 'All')

        # Make sure we're looking at the quad grid
        view = self.browser.create_view(InstanceAllView)
        view.toolbar.view_selector.select('Grid View')

        # Keeping paginator iteration here to create Quadicon object
        # using entities.get_first_entity won't give the quadicon object we need for compatibility
        for _ in view.entities.paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if quadicon.exists:
                if kwargs.get('mark', False):
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))
Ejemplo n.º 17
0
    def delete(self, cancel=False, wait_deleted=True, force=False):
        """Deletes the manager through UI

        Args:
            cancel (bool): Whether to cancel out of the deletion, when the alert pops up.
            wait_deleted (bool): Whether we want to wait for the manager to disappear from the UI.
                True will wait; False will only delete it and move on.
            force (bool): Whether to try to delete the manager even though it doesn't exist.
                True will try to delete it anyway; False will check for its existence and leave,
                if not present.
        """
        if not force and not self.exists:
            return
        navigate_to(self, 'All')
        sel.check(Quadicon(self.quad_name, None).checkbox())
        item_text = version.pick({
            '5.6': 'Remove selected items from the VMDB',
            '5.7': 'Remove selected items'
        })
        cfg_btn(item_text, invokes_alert=True)

        sel.handle_alert(cancel)
        if not cancel:
            flash_msg = version.pick({
                '5.6': 'Delete initiated for 1 provider',
                '5.7': 'Delete initiated for 1 Provider'
            })

            flash.assert_message_match(flash_msg)
            if wait_deleted:
                wait_for(func=lambda: self.exists,
                         fail_condition=True,
                         delay=15,
                         num_sec=60)
Ejemplo n.º 18
0
def reset_page():
    tb.select("Grid View")
    if sel.is_displayed(search_box.search_field):
        search.ensure_normal_search_empty()
    if paginator.page_controls_exist():
        # paginator.results_per_page(1000)
        sel.check(paginator.check_all())
        sel.uncheck(paginator.check_all())
Ejemplo n.º 19
0
 def delete(self):
     navigate_to(self, 'All')
     row = timeprofile_table.find_row_by_cells({'description': self.description})
     sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
     cfg_btn('Delete selected Time Profiles', invokes_alert=True)
     sel.handle_alert()
     flash.assert_success_message(
         'Time Profile "{}": Delete successful'.format(self.description))
def test_edit_default_analysis_profile():
    """ Test to validate edit default profiles."""
    p = HostAnalysisProfile("host sample", None, None)
    sel.force_navigate("cfg_analysis_profiles")
    row = records_table.find_row_by_cells({"Name": p.name})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select("Configuration", "Edit the selected Analysis Profiles")
    flash.assert_message_match('Sample Analysis Profile "{}" can not be edited'.format(p.name))
Ejemplo n.º 21
0
def test_delete_default_group():
    flash_msg = "EVM Group \"{}\": Error during delete: A read only group cannot be deleted."
    group = Group(description='EvmGroup-administrator')
    view = navigate_to(Group, 'All')
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    view.configuration.item_select('Delete selected Groups', handle_alert=True)
    view.flash.assert_message(flash_msg.format(group.description))
Ejemplo n.º 22
0
def test_delete_default_group():
    flash_msg = "EVM Group \"{}\": Error during delete: A read only group cannot be deleted."
    group = Group(description='EvmGroup-administrator')
    view = navigate_to(Group, 'All')
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    view.configuration.item_select('Delete selected Groups', handle_alert=True)
    view.flash.assert_message(flash_msg.format(group.description))
Ejemplo n.º 23
0
def test_edit_default_analysis_profile():
    """ Test to validate edit default profiles."""
    p = HostAnalysisProfile("host sample", None, None)
    sel.force_navigate("cfg_analysis_profiles")
    row = records_table.find_row_by_cells({'Name': p.name})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Edit the selected Analysis Profiles')
    flash.assert_message_match('Sample Analysis Profile "{}" can not be edited' .format(p.name))
Ejemplo n.º 24
0
def test_edit_default_group():
    flash_msg = 'Read Only EVM Group "{}" can not be edited'
    group = ac.Group(description='EvmGroup-approver')
    sel.force_navigate("cfg_accesscontrol_groups")
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Edit the selected Group')
    flash.assert_message_match(flash_msg.format(group.description))
def test_edit_default_group():
    flash_msg = 'Read Only EVM Group "{}" can not be edited'
    group = ac.Group(description='EvmGroup-approver')
    sel.force_navigate("cfg_accesscontrol_groups")
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Edit the selected Group')
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 26
0
 def delete(self):
     navigate_to(self, 'All')
     row = timeprofile_table.find_row_by_cells({'description': self.description})
     sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
     cfg_btn('Delete selected Time Profiles', invokes_alert=True)
     sel.handle_alert()
     flash.assert_success_message(
         'Time Profile "{}": Delete successful'.format(self.description))
def test_edit_default_analysis_profile():
    """ Test to validate edit default profiles."""
    p = AnalysisProfile(name="host sample", description=None, profile_type='Host')
    navigate_to(p, 'All')
    row = records_table.find_row_by_cells({'Name': p.name})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Edit the selected Analysis Profiles')
    flash.assert_message_match('Sample Analysis Profile "{}" can not be edited' .format(p.name))
def test_edit_default_group():
    flash_msg = 'Read Only EVM Group "{}" can not be edited'
    group = Group(description="EvmGroup-approver")
    navigate_to(Group, "All")
    row = group_table.find_row_by_cells({"Name": group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select("Configuration", "Edit the selected Group")
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 29
0
def _check_repo(name, callback=None):
    if current_version() >= '5.4':
        quadicon = Quadicon(name, "repository")
        sel.check(quadicon.checkbox())
    else:
        sel.check(sel.element('.//img', root=_repo_row(name)[0]))
    if callback:
        return callback()
Ejemplo n.º 30
0
def reset_page():
    tb.select("Grid View")
    if sel.is_displayed(search_box.search_field):
        search.ensure_normal_search_empty()
    if paginator.page_controls_exist():
        # paginator.results_per_page(1000)
        sel.check(paginator.check_all())
        sel.uncheck(paginator.check_all())
Ejemplo n.º 31
0
    def find_quadicon(self,
                      do_not_navigate=False,
                      mark=False,
                      refresh=True,
                      from_any_provider=False,
                      use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                navigate_to(self, 'All')
            elif self.is_vm:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            else:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                    self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(
                    self.name))

        paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # TODO rework search for archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                    else:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                self.name))
Ejemplo n.º 32
0
 def retire_stack(self, wait=True):
     navigate_to(self, 'All')
     sel.check(self.find_quadicon())
     lifecycle_btn("Retire this Orchestration Stack", invokes_alert=True)
     sel.handle_alert()
     flash.assert_success_message('Retirement initiated for 1 Orchestration'
                                  ' Stack from the CFME Database')
     if wait:
         self.wait_for_delete()
Ejemplo n.º 33
0
 def retire_stack(self, wait=True):
     navigate_to(self, 'All')
     sel.check(self.find_quadicon())
     lifecycle_btn("Retire this Orchestration Stack", invokes_alert=True)
     sel.handle_alert()
     flash.assert_success_message('Retirement initiated for 1 Orchestration'
     ' Stack from the CFME Database')
     if wait:
         self.wait_for_delete()
Ejemplo n.º 34
0
 def refresh_provider_relationships_ui(self, from_list_view=False):
     """Clicks on Refresh relationships button in provider"""
     if from_list_view:
         sel.force_navigate("{}_providers".format(self.page_name))
         sel.check(Quadicon(self.name, self.quad_name).checkbox())
     else:
         self.load_details()
     tb.select("Configuration", self.refresh_text, invokes_alert=True)
     sel.handle_alert(cancel=False)
Ejemplo n.º 35
0
 def refresh_provider_relationships_ui(self, from_list_view=False):
     """Clicks on Refresh relationships button in provider"""
     if from_list_view:
         navigate_to(self, 'All')
         sel.check(Quadicon(self.name, self.quad_name).checkbox())
     else:
         navigate_to(self, 'Details')
     tb.select("Configuration", self.refresh_text, invokes_alert=True)
     sel.handle_alert(cancel=False)
Ejemplo n.º 36
0
 def refresh_provider_relationships_ui(self, from_list_view=False):
     """Clicks on Refresh relationships button in provider"""
     if from_list_view:
         sel.force_navigate("{}_providers".format(self.page_name))
         sel.check(Quadicon(self.name, self.quad_name).checkbox())
     else:
         self.load_details()
     tb.select("Configuration", self.refresh_text, invokes_alert=True)
     sel.handle_alert(cancel=False)
Ejemplo n.º 37
0
 def refresh_provider_relationships_ui(self, from_list_view=False):
     """Clicks on Refresh relationships button in provider"""
     if from_list_view:
         navigate_to(self, 'All')
         sel.check(Quadicon(self.name, self.quad_name).checkbox())
     else:
         navigate_to(self, 'Details')
     tb.select("Configuration", self.refresh_text, invokes_alert=True)
     sel.handle_alert(cancel=False)
def test_delete_default_analysis_profile():
    """ Test to validate delete default profiles."""
    p = HostAnalysisProfile("host sample", None, None)
    sel.force_navigate("cfg_analysis_profiles")
    row = records_table.find_row_by_cells({"Name": p.name})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select("Configuration", "Delete the selected Analysis Profiles from the VMDB", invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match('Default Analysis Profile "{}" can not be deleted'.format(p.name))
Ejemplo n.º 39
0
 def refresh_provider_relationships(self, from_list_view=False):
     """Clicks on Refresh relationships button in provider"""
     if from_list_view:
         sel.force_navigate("infrastructure_providers")
         sel.check(Quadicon(self.name, "infra_prov").checkbox())
     else:
         sel.force_navigate('infrastructure_provider', context={"provider": self})
     tb.select("Configuration", "Refresh Relationships and Power States", invokes_alert=True)
     sel.handle_alert(cancel=False)
Ejemplo n.º 40
0
def test_delete_default_group():
    flash_msg = "EVM Group \"{}\": Error during 'destroy': A read only group cannot be deleted."
    group = ac.Group(description="EvmGroup-administrator")
    sel.force_navigate("cfg_accesscontrol_groups")
    row = group_table.find_row_by_cells({"Name": group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select("Configuration", "Delete selected Groups", invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 41
0
 def resetter(self):
     if version.current_version() < '5.8':
         self.view.Filters.tree.click_path('All Containers')
     else:
         self.view.Filters.Navigation.select('ALL (Default)')
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Ejemplo n.º 42
0
 def resetter(self):
     accordion.tree('Containers', version.pick({
         version.LOWEST: 'All Containers',
         '5.7': 'All Containers (by Pods)',
     }))
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Ejemplo n.º 43
0
    def refresh_relationships(self, cancel=False):
        """Refreshes relationships and power states of this manager"""
        navigate_to(self, 'All')

        sel.check(Quadicon(self.quad_name, None).checkbox())
        cfg_btn('Refresh Relationships and Power states', invokes_alert=True)

        sel.handle_alert(cancel)
        if not cancel:
            flash.assert_message_match(self._refresh_flash_msg)
Ejemplo n.º 44
0
def test_delete_default_group():
    flash_msg = \
        'EVM Group "{}": Error during \'destroy\': A read only group cannot be deleted.'
    group = ac.Group(description='EvmGroup-administrator')
    sel.force_navigate("cfg_accesscontrol_groups")
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Delete selected Groups', invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 45
0
def test_delete_default_group():
    flash_msg = "EVM Group \"{}\": Error during delete: A read only group cannot be deleted."
    group = Group(description='EvmGroup-administrator')
    navigate_to(Group, 'All')
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    sleep(10)  # todo: temporary fix of js issue, to remove when switch to widgetastic
    tb.select('Configuration', 'Delete selected Groups', invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 46
0
def test_delete_default_group():
    flash_msg = "EVM Group \"{}\": Error during delete: A read only group cannot be deleted."
    group = Group(description='EvmGroup-administrator')
    navigate_to(Group, 'All')
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    sleep(10)  # todo: temporary fix of js issue, to remove when switch to widgetastic
    tb.select('Configuration', 'Delete selected Groups', invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 47
0
    def refresh_relationships(self, cancel=False):
        """Refreshes relationships and power states of this manager"""
        navigate_to(self, 'All')

        sel.check(Quadicon(self.quad_name, None).checkbox())
        cfg_btn('Refresh Relationships and Power states', invokes_alert=True)

        sel.handle_alert(cancel)
        if not cancel:
            flash.assert_message_match(self._refresh_flash_msg)
Ejemplo n.º 48
0
def test_delete_default_analysis_profile():
    """ Test to validate delete default profiles."""
    p = HostAnalysisProfile("host sample", None, None)
    sel.force_navigate("cfg_analysis_profiles")
    row = records_table.find_row_by_cells({'Name': p.name})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Delete the selected Analysis Profiles from the VMDB',
            invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match('Default Analysis Profile "{}" can not be deleted' .format(p.name))
Ejemplo n.º 49
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # We don't use provider-specific page (vm_templates_provider_branch) here
                    # as those don't list archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self.provider, 'Instances')
                    else:
                        navigate_to(self.provider, self.provider.templates_destination_name)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))

        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Ejemplo n.º 50
0
 def resetter(self):
     # Reset view and selection
     if version.current_version() >= '5.7':
         accordion.tree('Datastores', 'All Datastores')
     else:
         # todo: there is unsupported accordion in 5.6.3.3. currently it isn't necessary
         # for existing tests
         pass
     tb.select("Grid View")
     sel.check(paginator.check_all())
     sel.uncheck(paginator.check_all())
Ejemplo n.º 51
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # We don't use provider-specific page (vm_templates_provider_branch) here
                    # as those don't list archived/orphaned VMs
                    if self.is_vm:
                        sel.force_navigate(self.provider.instances_page_name)
                    else:
                        sel.force_navigate(self.provider.templates_page_name)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))

        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Ejemplo n.º 52
0
 def resetter(self):
     accordion.tree(
         'Containers',
         version.pick({
             version.LOWEST: 'All Containers',
             '5.7': 'All Containers (by Pods)',
         }))
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Ejemplo n.º 53
0
 def resetter(self):
     # Reset view and selection
     if self.obj.appliance.version >= '5.7':
         accordion.tree('Datastores', 'All Datastores')
     else:
         # todo: there is unsupported accordion in 5.6.3.3. currently it isn't necessary
         # for existing tests
         pass
     tb.select("Grid View")
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Ejemplo n.º 54
0
 def refresh_provider_relationships(self, from_list_view=False):
     """Clicks on Refresh relationships button in provider"""
     if from_list_view:
         sel.force_navigate("{}_providers".format(self.page_name))
         sel.check(Quadicon(self.name, self.quad_name).checkbox())
     else:
         sel.force_navigate('{}_provider'.format(self.page_name),
                            context={"provider": self})
     tb.select("Configuration",
               "Refresh Relationships and Power States",
               invokes_alert=True)
     sel.handle_alert(cancel=False)
Ejemplo n.º 55
0
def test_delete_default_group():
    flash_msg = version.pick({
        '5.6': ("EVM Group \"{}\": Error during delete: A read only group cannot be deleted."),
        '5.5': ("EVM Group \"{}\": Error during \'destroy\': A read only group cannot be deleted.")
    })
    group = ac.Group(description='EvmGroup-administrator')
    sel.force_navigate("cfg_accesscontrol_groups")
    row = group_table.find_row_by_cells({'Name': group.description})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Delete selected Groups', invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match(flash_msg.format(group.description))
Ejemplo n.º 56
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                navigate_to(self, 'All')
            elif self.is_vm:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            else:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # TODO rework search for archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                    else:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Ejemplo n.º 57
0
def navigate_and_select_all_hosts(host_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(host_names, basestring):
        host_names = [host_names]

    if provider_crud:
        navigate_to(provider_crud, 'ProviderNodes')
    else:
        navigate_to(Host, 'All')
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for host_name in host_names:
        sel.check(Quadicon(host_name, 'host').checkbox())
Ejemplo n.º 58
0
def _method_setup(vm_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(vm_names, basestring):
        vm_names = [vm_names]

    if provider_crud:
        provider_crud.load_all_provider_instances()
    else:
        sel.force_navigate('clouds_instances')
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for vm_name in vm_names:
        sel.check(Quadicon(vm_name, 'instance').checkbox())
Ejemplo n.º 59
0
def _method_setup(vm_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(vm_names, basestring):
        vm_names = [vm_names]

    if provider_crud:
        provider_crud.load_all_provider_vms()
    else:
        navigate_to(Vm, 'VMsOnly')
    from cfme.web_ui import paginator
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for vm_name in vm_names:
        sel.check(Quadicon(vm_name, 'vm').checkbox())