コード例 #1
0
def test_no_template_power_control(provider, setup_provider_funcscope, soft_assert):
    """ Ensures that no power button is displayed for templates.

    Prerequisities:
        * An infra provider that has some templates.

    Steps:
        * Open the view of all templates of the provider
        * Verify the Power toolbar button is not visible
        * Select some template using the checkbox
        * Verify the Power toolbar button is not visible
        * Click on some template to get into the details page
        * Verify the Power toolbar button is not visible
    """
    provider.load_all_provider_templates()
    toolbar.select('Grid View')
    soft_assert(not toolbar.exists("Power"), "Power displayed in template grid view!")

    # Ensure selecting a template doesn't cause power menu to appear
    templates = list(get_all_vms(True))
    template_name = random.choice(templates)
    selected_template = VM.factory(template_name, provider, template=True)

    # Check the power button with checking the quadicon
    quadicon = selected_template.find_quadicon(do_not_navigate=True, mark=True, refresh=False)
    soft_assert(not toolbar.exists("Power"), "Power displayed when template quadicon checked!")

    # Ensure there isn't a power button on the details page
    pytest.sel.click(quadicon)
    soft_assert(not toolbar.exists("Power"), "Power displayed in template details!")
コード例 #2
0
def check_power_options(provider, soft_assert, vm, power_state):
    must_be_available = {
        'on': [vm.POWER_OFF, vm.SUSPEND, vm.RESET],
        'off': [vm.POWER_ON]
    }
    mustnt_be_available = {
        'on': [vm.POWER_ON],
        'off': [vm.POWER_OFF, vm.SUSPEND, vm.RESET]
    }
    # VMware and RHEVM have extended power options
    if not provider.one_of(SCVMMProvider):
        mustnt_be_available['on'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
        mustnt_be_available['off'].extend(
            [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
    if provider.one_of(RHEVMProvider):
        must_be_available['on'].remove(vm.RESET)
    vm.load_details()
    toolbar.pf_select('Power')
    for pwr_option in must_be_available[power_state]:
        soft_assert(
            toolbar.exists('Power', pwr_option),
            "'{}' must be available in current power state - '{}' ".format(
                pwr_option, power_state))
    for pwr_option in mustnt_be_available[power_state]:
        soft_assert(
            not toolbar.exists('Power', pwr_option),
            "'{}' must not be available in current power state - '{}' ".format(
                pwr_option, power_state))
コード例 #3
0
def check_power_options(provider, soft_assert, vm, power_state):
    must_be_available = {
        'on': [vm.POWER_OFF, vm.SUSPEND, vm.RESET],
        'off': [vm.POWER_ON]
    }
    mustnt_be_available = {
        'on': [vm.POWER_ON],
        'off': [vm.POWER_OFF, vm.SUSPEND, vm.RESET]
    }
    # VMware and RHEVM have extended power options
    if not provider.one_of(SCVMMProvider):
        mustnt_be_available['on'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
        mustnt_be_available['off'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
    if provider.one_of(RHEVMProvider):
        must_be_available['on'].remove(vm.RESET)
    vm.load_details()
    toolbar.pf_select('Power')
    for pwr_option in must_be_available[power_state]:
        soft_assert(
            toolbar.exists('Power', pwr_option),
            "'{}' must be available in current power state - '{}' ".format(
                pwr_option, power_state))
    for pwr_option in mustnt_be_available[power_state]:
        soft_assert(
            not toolbar.exists('Power', pwr_option),
            "'{}' must not be available in current power state - '{}' ".format(
                pwr_option, power_state))
コード例 #4
0
def test_no_template_power_control(provider, soft_assert):
    """ Ensures that no power button is displayed for templates.

    Prerequisities:
        * An infra provider that has some templates.

    Steps:
        * Open the view of all templates of the provider
        * Verify the Power toolbar button is not visible
        * Select some template using the checkbox
        * Verify the Power toolbar button is not visible
        * Click on some template to get into the details page
        * Verify the Power toolbar button is not visible
    """
    provider.load_all_provider_templates()
    toolbar.select('Grid View')
    soft_assert(not toolbar.exists("Power"),
                "Power displayed in template grid view!")

    # Ensure selecting a template doesn't cause power menu to appear
    templates = list(get_all_vms(True))
    template_name = random.choice(templates)
    selected_template = VM.factory(template_name, provider, template=True)

    # Check the power button with checking the quadicon
    entity = selected_template.find_quadicon()
    entity.check()
    soft_assert(not toolbar.exists("Power"),
                "Power displayed when template quadicon checked!")

    # Ensure there isn't a power button on the details page
    entity.click()
    soft_assert(not toolbar.exists("Power"),
                "Power displayed in template details!")
コード例 #5
0
def check_power_options(provider, soft_assert, vm, power_state):
    must_be_available = {'on': [vm.POWER_OFF, vm.SUSPEND, vm.RESET],
                         'off': [vm.POWER_ON]
                         }
    mustnt_be_available = {'on': [vm.POWER_ON],
                           'off': [vm.POWER_OFF, vm.SUSPEND, vm.RESET]
                           }
    # VMware and RHEVM have extended power options
    if provider.type != 'scvmm':
        must_be_available['on'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
        mustnt_be_available['off'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
    if provider.type == 'rhevm':
        must_be_available['on'].remove(vm.RESET)
        must_be_available['on'].remove(vm.GUEST_RESTART)
    vm.load_details()
    toolbar.pf_select('Power')
    for pwr_option in must_be_available[power_state]:
        soft_assert(
            toolbar.exists('Power', pwr_option),
            "'{}' must be available in current power state - '{}' ".format(
                pwr_option, power_state))
    for pwr_option in mustnt_be_available[power_state]:
        soft_assert(
            not toolbar.exists('Power', pwr_option),
            "'{}' must not be available in current power state - '{}' ".format(
                pwr_option, power_state))
    # check if Guest OS power operations exist and greyed from "on"
    if power_state == vm.STATE_ON and (provider.type != 'scvmm' and provider.type != 'rhevm'):
        for pwr_option in [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN]:
            soft_assert(-
                toolbar.is_greyed('Power', pwr_option),
                "'{}' must be greyed/disabled in current power state - '{}' ".format(
                    pwr_option, power_state))
コード例 #6
0
def test_cockpit_button_access(provider, appliance, soft_assert):
    """ The test verifies the existence of cockpit "Web Console"
        button on master node, then presses on the button and
        opens up the cockpit main page in a new window. Then
        we verify the title of the main cockpit page. The test
        will not work until the single sign-on bug is fixed

    """

    collection = appliance.collections.nodes
    nodes = collection.all()
    node = [node for node in nodes if 'master' in node.name][0]
    navigate_to(node, 'Details')

    soft_assert(
        tb.exists(
            'Open a new browser window with Cockpit for this '
            'VM.  This requires that Cockpit is pre-configured on the VM.'),
        'No "Web Console" button found')
    tb.select('Open a new browser window with Cockpit for this '
              'VM.  This requires that Cockpit is pre-configured on the VM.')

    port_num = ':9090/system'
    url_cockpit = provider.hostname + port_num
    sel.get(url_cockpit)
    title_pg = sel.title()
    soft_assert(title_pg == 'Cockpit', 'Cockpit main page failed to open')
コード例 #7
0
def test_current_user_login_delete(request):
    """Test for deleting current user login.

    Steps:
        * Login as Admin user
        * Create a new user
        * Login with the new user
        * Try deleting the user
    """
    group_user = Group("EvmGroup-super_administrator")
    user = User(
        name='user' + fauxfactory.gen_alphanumeric(),
        credential=new_credential(),
        email='*****@*****.**',
        group=group_user)
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(login.login_admin)
    with user:
        if version.current_version() >= '5.7':
            navigate_to(user, 'Details')
            menu_item = ('Configuration', 'Delete this User')
            assert tb.exists(*menu_item) and tb.is_greyed(*menu_item), "Delete User is not dimmed"
        else:
            with error.expected("Current EVM User \"{}\" cannot be deleted".format(user.name)):
                user.delete()
コード例 #8
0
def test_current_user_login_delete(request):
    """Test for deleting current user login.

    Steps:
        * Login as Admin user
        * Create a new user
        * Login with the new user
        * Try deleting the user
    """
    group_user = Group("EvmGroup-super_administrator")
    user = User(name='user' + fauxfactory.gen_alphanumeric(),
                credential=new_credential(),
                email='*****@*****.**',
                group=group_user)
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(user.appliance.server.login_admin())
    with user:
        if version.current_version() >= '5.7':
            navigate_to(user, 'Details')
            menu_item = ('Configuration', 'Delete this User')
            assert tb.exists(*menu_item) and tb.is_greyed(
                *menu_item), "Delete User is not dimmed"
        else:
            with error.expected(
                    "Current EVM User \"{}\" cannot be deleted".format(
                        user.name)):
                user.delete()
コード例 #9
0
ファイル: test_cockpit.py プロジェクト: dajohnso/cfme_tests
def test_cockpit_button_access(provider, soft_assert):
    """ The test verifies the existence of cockpit "Web Console"
        button on master node, then presses on the button and
        opens up the cockpit main page in a new window. Then
        we verify the title of the main cockpit page. The test
        will not work until the single sign-on bug is fixed

    """

    collection = NodeCollection()
    nodes = collection.all()
    node = [node for node in nodes if 'master' in node.name][0]
    navigate_to(node, 'Details')

    soft_assert(
        tb.exists(
            'Open a new browser window with Cockpit for this '
            'VM.  This requires that Cockpit is pre-configured on the VM.'),
        'No "Web Console" button found')
    tb.select('Open a new browser window with Cockpit for this '
              'VM.  This requires that Cockpit is pre-configured on the VM.')

    port_num = ':9090/system'
    url_cockpit = provider.hostname + port_num
    sel.get(url_cockpit)
    title_pg = sel.title()
    soft_assert(title_pg == 'Cockpit', 'Cockpit main page failed to open')
コード例 #10
0
def test_no_power_controls_on_archived_vm(testing_vm, archived_vm, soft_assert):
    """ Ensures that no power button is displayed from details view of archived vm

    Prerequisities:
        * Archived VM
    Steps:
        * Open the view of VM Details
        * Verify the Power toolbar button is not visible
    """
    testing_vm.load_details()
    soft_assert(not toolbar.exists("Power"), "Power displayed in template details!")
コード例 #11
0
def test_no_power_controls_on_archived_vm(testing_vm, archived_vm, soft_assert):
    """ Ensures that no power button is displayed from details view of archived vm

    Prerequisities:
        * Archived VM
    Steps:
        * Open the view of VM Details
        * Verify the Power toolbar button is not visible
    """
    testing_vm.load_details(from_any_provider=True)
    soft_assert(not toolbar.exists("Power"), "Power displayed in template details!")
コード例 #12
0
def check_power_options(provider, soft_assert, vm, power_state):
    must_be_available = {
        'on': [vm.POWER_OFF, vm.SUSPEND, vm.RESET],
        'off': [vm.POWER_ON]
    }
    mustnt_be_available = {
        'on': [vm.POWER_ON],
        'off': [vm.POWER_OFF, vm.SUSPEND, vm.RESET]
    }
    # VMware and RHEVM have extended power options
    if provider.type != 'scvmm':
        must_be_available['on'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
        mustnt_be_available['off'].extend(
            [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
    if provider.type == 'rhevm':
        must_be_available['on'].remove(vm.RESET)
        must_be_available['on'].remove(vm.GUEST_RESTART)
    vm.load_details()
    toolbar.pf_select('Power')
    for pwr_option in must_be_available[power_state]:
        soft_assert(
            toolbar.exists('Power', pwr_option),
            "'{}' must be available in current power state - '{}' ".format(
                pwr_option, power_state))
    for pwr_option in mustnt_be_available[power_state]:
        soft_assert(
            not toolbar.exists('Power', pwr_option),
            "'{}' must not be available in current power state - '{}' ".format(
                pwr_option, power_state))
    # check if Guest OS power operations exist and greyed from "on"
    if power_state == vm.STATE_ON and (provider.type != 'scvmm'
                                       and provider.type != 'rhevm'):
        for pwr_option in [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN]:
            soft_assert(
                -toolbar.is_greyed('Power', pwr_option),
                "'{}' must be greyed/disabled in current power state - '{}' ".
                format(pwr_option, power_state))
コード例 #13
0
 def is_immutable(self):
     return not (tb.exists("Power") or tb.exists("Deployments")
                 or tb.exists("JDBC Drivers") or tb.exists("Datasources"))
コード例 #14
0
ファイル: server.py プロジェクト: dajohnso/cfme_tests
 def is_immutable(self):
     return not (tb.exists("Power") or
                 tb.exists("Deployments") or
                 tb.exists("JDBC Drivers") or
                 tb.exists("Datasources"))