コード例 #1
0
def test_ssa_packages(provider, instance, soft_assert):
    """ Tests SSA fetches correct results for packages

    Metadata:
        test_flag: vm_analysis
    """

    if instance.system_type == WINDOWS:
        pytest.skip("Windows has no packages")

    expected = None
    if 'package' not in instance.system_type.keys():
        pytest.skip("Don't know how to update packages for {}".format(
            instance.system_type))

    package_name = instance.system_type['package']
    package_command = instance.system_type['install-command']
    package_number_command = instance.system_type['package-number']

    cmd = package_command.format(package_name)
    output = instance.ssh.run_command(cmd.format(package_name)).output
    logger.info("{0} output:\n{1}".format(cmd, output))

    expected = instance.ssh.run_command(package_number_command).output.strip(
        '\n')

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="10m",
             fail_func=lambda: tb.select('Reload'))

    # Check that all data has been fetched
    current = instance.get_detail(properties=('Configuration', 'Packages'))
    assert current == expected

    # Make sure new package is listed
    sel.click(InfoBlock("Configuration", "Packages"))
    template = '//div[@id="list_grid"]/div[@class="{}"]/table/tbody'
    packages = version.pick({
        version.LOWEST:
        SplitTable(header_data=(template.format("xhdr"), 1),
                   body_data=(template.format("objbox"), 0)),
        "5.5":
        Table('//table'),
    })

    for page in paginator.pages():
        if packages.find_row('Name', package_name):
            return
    pytest.fail("Package {0} was not found".format(package_name))
コード例 #2
0
def test_ssa_users(provider, instance, soft_assert):
    """ Tests SSA fetches correct results for users list

    Metadata:
        test_flag: vm_analysis
    """
    username = fauxfactory.gen_alphanumeric()
    expected = None

    # In windows case we can't add new users (yet)
    # So we simply check that user list doesn't cause any Rails errors
    if instance.system_type != WINDOWS:
        # Add a new user
        instance.ssh.run_command("userdel {0} || useradd {0}".format(username))
        expected = instance.ssh.run_command(
            "cat /etc/passwd | wc -l").output.strip('\n')

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="10m",
             fail_func=lambda: tb.select('Reload'))

    # Check that all data has been fetched
    current = instance.get_detail(properties=('Security', 'Users'))
    if instance.system_type != WINDOWS:
        assert current == expected

    # Make sure created user is in the list
    sel.click(InfoBlock("Security", "Users"))
    template = '//div[@id="list_grid"]/div[@class="{}"]/table/tbody'
    users = version.pick({
        version.LOWEST:
        SplitTable(header_data=(template.format("xhdr"), 1),
                   body_data=(template.format("objbox"), 0)),
        "5.5":
        Table('//table'),
    })

    for page in paginator.pages():
        sel.wait_for_element(users)
        if users.find_row('Name', username):
            return
    if instance.system_type != WINDOWS:
        pytest.fail("User {0} was not found".format(username))
コード例 #3
0
def test_ssa_groups(provider, instance, soft_assert):
    """ Tests SSA fetches correct results for groups

    Metadata:
        test_flag: vm_analysis
    """
    group = fauxfactory.gen_alphanumeric()
    expected = None

    if instance.system_type != WINDOWS:
        # Add a new group
        instance.ssh.run_command("groupdel {0} || groupadd {0}".format(group))
        expected = instance.ssh.run_command(
            "cat /etc/group | wc -l").output.strip('\n')

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="10m",
             fail_func=lambda: tb.select('Reload'))

    # Check that all data has been fetched
    current = instance.get_detail(properties=('Security', 'Groups'))
    if instance.system_type != WINDOWS:
        assert current == expected

    # Make sure created group is in the list
    sel.click(InfoBlock("Security", "Groups"))
    template = '//div[@id="list_grid"]/div[@class="{}"]/table/tbody'
    groups = version.pick({
        version.LOWEST:
        SplitTable(header_data=(template.format("xhdr"), 1),
                   body_data=(template.format("objbox"), 0)),
        "5.5":
        Table('//table'),
    })

    for page in paginator.pages():
        sel.wait_for_element(groups)
        if groups.find_row('Name', group):
            return
    if instance.system_type != WINDOWS:
        pytest.fail("Group {0} was not found".format(group))
コード例 #4
0
from utils.update import Updateable
from utils.wait import wait_for

properties_form = Form(fields=[(
    'name_text',
    Input('name')), ('url_text',
                     Input('url')), ('ssl_checkbox', Input('verify_ssl'))])

credential_form = Form(
    fields=[('principal_text',
             Input('log_userid')), ('secret_pass', Input('log_password')),
            ('verify_secret_pass',
             Input('log_verify')), ('validate_btn', form_buttons.validate)])

list_table = SplitTable(
    header_data=("//div[@id='list_grid']/div[@class='xhdr']/table/tbody", 1),
    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),
)

add_manager_btn = form_buttons.FormButton('Add')
edit_manager_btn = form_buttons.FormButton('Save changes')
cfg_btn = partial(tb.select, 'Configuration')

nav.add_branch(
    'infrastructure_config_management', {
        'infrastructure_config_managers': [
            lambda _: (accordion.tree(
                'Providers',
                version.pick({
                    version.LOWEST: 'All Red Hat Satellite Providers',
                    version.UPSTREAM: 'All Foreman Providers'
                })), tb.select('Grid View')),
コード例 #5
0
from cfme import web_ui as ui
from xml.sax.saxutils import quoteattr
from cfme.exceptions import CFMEException
from utils.wait import wait_for
from utils import version

details_page = Region(infoblock_type='detail')
cfg_btn = partial(tb.select, "Configuration")
pol_btn = partial(tb.select, 'Policy')
lifecycle_btn = partial(tb.select, 'Lifecycle')
output_table = version.pick({
    '5.5':
    Table('//div[@id="list_grid"]/table'),
    '5.4':
    SplitTable(
        ('//*[@id="list_grid"]//table[contains(@class, "hdr")]/tbody', 1),
        ('//*[@id="list_grid"]//table[contains(@class, "obj")]/tbody', 1))
})

edit_tags_form = Form(fields=[(
    "select_tag",
    ui.Select("select#tag_cat")), ("select_value",
                                   ui.Select("select#tag_add"))])

nav.add_branch('clouds_stacks', {
    'clouds_stack':
    lambda ctx: sel.click(Quadicon(ctx['stack'].name, 'stack'))
})


class Stack(Pretty):
コード例 #6
0
    ('add_entry_button', Input("accept")),
    # This one too? vvv I could not find it in the form
    ('field_category', Select("//select[@id='field_category']")),
    ('text_area', {
        version.LOWEST: Input("field_default_value"),
        "5.5": AngularSelect("field_default_value")
    }),
    ('dynamic_chkbox', Input("field_dynamic")),
    ('apply_btn', '//a[@title="Apply"]')
])

common = Region(
    locators={
        "dialogs_table": {
            version.LOWEST:
            SplitTable(header_data=('//div[@class="xhdr"]/table/tbody', 1),
                       body_data=('//div[@class="objbox"]/table/tbody', 1)),
            "5.5":
            Table("//div[@id='list_grid']/table")
        }
    })


def _all_servicedialogs_add_new(context):
    cfg_btn('Add a new Dialog')
    sel.wait_for_element(label_form.label)


menu.nav.add_branch(
    'automate_customization', {
        'service_dialogs': [
            lambda _: accordion.tree("Service Dialogs", "All Dialogs"), {
コード例 #7
0
            '5.6': AngularSelect("provider_type")}),
        ('url_text', Input('url')),
        ('ssl_checkbox', Input('verify_ssl'))
    ])

credential_form = Form(
    fields=[
        ('principal_text', Input('log_userid')),
        ('secret_pass', Input('log_password')),
        ('verify_secret_pass', Input('log_verify')),
        ('validate_btn', form_buttons.validate)
    ])


CfgMgrSplitTable = lambda: SplitTable(
    header_data=("//div[@id='list_grid']/div[@class='xhdr']/table/tbody", 1),
    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),)

CfgMgrTable = lambda: Table("//div[@id='main_div']//div[@id='list_grid']/table")


page = Region(locators={
    'list_table_config_profiles': {
        version.LOWEST: CfgMgrSplitTable(),
        "5.5": CfgMgrTable()},
    'list_table_config_systems': {
        version.LOWEST: CfgMgrSplitTable(),
        "5.5": CfgMgrTable()}})

add_manager_btn = form_buttons.FormButton('Add')
edit_manager_btn = form_buttons.FormButton('Save changes')
コード例 #8
0
ファイル: file_shares.py プロジェクト: vrutkovs/cfme_tests
# -*- coding: utf-8 -*-
from collections import namedtuple

import cfme.web_ui.menu as menu
assert menu  # To stop complaining

from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import SplitTable, Region, paginator


list_page = Region(locators=dict(
    file_shares_table=SplitTable(
        header_data=("//div[@id='list_grid']/div[@class='xhdr']/table/tbody", 1),
        body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),
    ),
))

# TODO: Extend it to be a proper class, because you can do stuff with that
FileShare = namedtuple("FileShare", [
    "name", "element_name", "vms", "hosts", "datastores", "op_status", "region", "last_upd_status"
])


def all():
    """Returns all of the file shares available"""
    sel.force_navigate("file_shares")
    for page in paginator.pages():
        for row in list_page.file_shares_table.rows():
            yield FileShare(
                name=sel.text_sane(row.name),
                element_name=sel.text_sane(row.element_name),
コード例 #9
0
""" Page functions for Security Group page


:var list_page: A :py:class:`cfme.web_ui.Region` object describing elements on the list page.
:var details_page: A :py:class:`cfme.web_ui.Region` object describing elements on the detail page.
"""

from cfme.web_ui import Region, SplitTable


# Page specific locators
list_page = Region(
    locators={
        'security_group_table': SplitTable(header_data=('//div[@class="xhdr"]/table/tbody', 1),
            body_data=('//div[@class="objbox"]/table/tbody', 1))
    },
    title='Security Groups')


details_page = Region(infoblock_type='detail')
コード例 #10
0
ファイル: volumes.py プロジェクト: vrutkovs/cfme_tests
# -*- coding: utf-8 -*-
from collections import namedtuple

import cfme.web_ui.menu as menu
assert menu

from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import Region, SplitTable, paginator

list_page = Region(locators=dict(volumes_table=SplitTable(
    header_data=("//div[@id='list_grid']/div[@class='xhdr']/table/tbody", 1),
    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),
), ))

# TODO: Extend it to be a proper class, because you can do stuff with that
Volume = namedtuple("Volume", [
    "name", "element_name", "vms", "hosts", "datastores", "health_status",
    "op_status", "description", "region", "last_upd_status"
])


def all():
    """Returns all of the file shares available"""
    sel.force_navigate("volumes")
    for page in paginator.pages():
        for row in list_page.volumes_table.rows():
            yield Volume(name=sel.text_sane(row.name),
                         element_name=sel.text_sane(row.element_name),
                         vms=int(sel.text_sane(row.vms)),
                         hosts=int(sel.text_sane(row.hosts)),
                         datastores=int(sel.text_sane(row.datastores)),
コード例 #11
0
    fields=[
        ('name_text', Input('name')),
        ('url_text', Input('url')),
        ('ssl_checkbox', Input('verify_ssl'))
    ])

credential_form = Form(
    fields=[
        ('principal_text', Input('log_userid')),
        ('secret_pass', Input('log_password')),
        ('verify_secret_pass', Input('log_verify')),
        ('validate_btn', form_buttons.validate)
    ])

list_table = SplitTable(
    header_data=("//div[@id='list_grid']/div[@class='xhdr']/table/tbody", 1),
    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),
)

add_manager_btn = form_buttons.FormButton('Add')
edit_manager_btn = form_buttons.FormButton('Save changes')
cfg_btn = partial(tb.select, 'Configuration')

nav.add_branch(
    'infrastructure_config_management',
    {
        'infrastructure_config_managers':
        [
            lambda _: (accordion.tree('Providers',
                version.pick({version.LOWEST: 'All Red Hat Satellite Providers',
                              version.UPSTREAM: 'All Foreman Providers'})),
                toolbar.set_vms_grid_view()),