Beispiel #1
0
from functools import partial

from selenium.webdriver.common.by import By

import cfme.web_ui.accordion as accordion
import cfme.web_ui.toolbar as tb
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Select, Tree, fill, flash
from cfme.web_ui.menu import nav
from utils.update import Updateable

rate_tree = Tree("//div[@id='cb_rates_treebox']/ul")
tb_select = partial(tb.select, "Configuration")
tb_select_new_chargeback = nav.fn(partial(tb_select, "Add a new Chargeback Rate"))
tb_select_edit_chargeback = nav.fn(partial(tb_select, "Edit this Chargeback Rate"))


class RateFormItem(object):
    def __init__(self, rate_loc=None, unit_select_loc=None):
        self.rate_loc = rate_loc
        self.unit_select_loc = unit_select_loc


def _mkitem(index):
    return RateFormItem(
        (By.CSS_SELECTOR, "input#rate_" + str(index)), Select((By.CSS_SELECTOR, "select#per_time_" + str(index)))
    )


rate_form = Form(
    fields=[
Beispiel #2
0
        'cfg_accesscontrol_Roles': [
            lambda d: accordion.tree("Access Control", server_region_string(),
                                     "Roles"), {
                                         'cfg_accesscontrol_role_add':
                                         lambda d: tb_select("Add a new Role")
                                     }
        ],
        'cfg_accesscontrol_role_ed': [
            lambda ctx: accordion.tree("Access Control", server_region_string(
            ), "Roles", ctx.role.name), {
                'cfg_accesscontrol_role_edit':
                lambda d: tb_select('Edit this Role')
            }
        ],
        'chargeback_assignments':
        nav.fn(partial(accordion.click, "Assignments"))
    })


@extend_nav
class configuration:
    def cfg_tenant_project_create(context):
        tenant = context["tenant"]
        if tenant._default:
            raise ValueError("Cannot create the root tenant {}".format(
                tenant.name))
        accordion.tree("Access Control", server_region_string(), "Tenants",
                       *tenant.parent_path)
        if type(tenant) is Tenant:
            tb_select("Add child Tenant to this Tenant")
        elif type(tenant) is Project:
Beispiel #3
0
                lambda d: tb_select("Add a new Role")
            }
        ],

        'cfg_accesscontrol_role_ed':
        [
            lambda ctx:
            accordion.tree("Access Control", server_region_string(), "Roles", ctx.role.name),
            {
                'cfg_accesscontrol_role_edit':
                lambda d: tb_select('Edit this Role')
            }
        ],

        'chargeback_assignments':
        nav.fn(partial(accordion.click, "Assignments"))
    }
)


@extend_nav
class configuration:
    def cfg_tenant_project_create(context):
        tenant = context["tenant"]
        if tenant._default:
            raise ValueError("Cannot create the root tenant {}".format(tenant.name))
        accordion.tree("Access Control", server_region_string(), "Tenants", *tenant.parent_path)
        if type(tenant) is Tenant:
            tb_select("Add child Tenant to this Tenant")
        elif type(tenant) is Project:
            tb_select("Add Project to this Tenant")
from selenium.webdriver.common.by import By

import cfme.web_ui.accordion as accordion
import cfme.web_ui.toolbar as tb
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Select, Tree, fill, flash, form_buttons
from cfme.web_ui.menu import nav
from utils.pretty import Pretty
from utils.update import Updateable
from utils.version import LOWEST

rate_tree = Tree("//div[@id='cb_rates_treebox']/ul")
assignment_tree = Tree("//div[@id='cb_assignments_treebox']/ul")
tb_select = partial(tb.select, "Configuration")
tb_select_new_chargeback = nav.fn(partial(tb_select, "Add a new Chargeback Rate"))
tb_select_edit_chargeback = nav.fn(partial(tb_select, "Edit this Chargeback Rate"))


class RateFormItem(Pretty):
    pretty_attrs = ['rate_loc', 'unit_select_loc']

    def __init__(self, rate_loc=None, unit_select_loc=None):
        self.rate_loc = rate_loc
        self.unit_select_loc = unit_select_loc


def _mkitem(index):
    return RateFormItem((By.CSS_SELECTOR, "input#rate_" + str(index)),
                        Select((By.CSS_SELECTOR, "select#per_time_" + str(index))))
Beispiel #5
0
        # "5.3": ["CFME Region: Region %d [%d]" % server_region_pair()] + list(path),
        version.LOWEST: path,
    })
    return accordion.tree(
        "Access Control",
        *path
    )

tb_select = partial(tb.select, "Configuration")
# pol_btn = partial(tb.select, "Policy")
nav.add_branch(
    'configuration',
    {
        'configuration_accesscontrol':
        [
            nav.fn(partial(accordion.click, "Access Control")),
            {
                'cfg_accesscontrol_users':
                [
                    lambda d: ac_tree("Users"),
                    {
                        'cfg_accesscontrol_user_add':
                        lambda d: tb.select("Configuration", "Add a new User")
                    }
                ],

                'cfg_accesscontrol_user_ed':
                [
                    lambda ctx: ac_tree('Users', ctx.name),
                    {
                        'cfg_accesscontrol_user_edit':
Beispiel #6
0
    path = version.pick(
        {
            # "9.9.9.9": ["CFME Region: Region %d [%d]" % server_region_pair()] + list(path),
            "default": path
        }
    )
    return accordion.tree("Access Control", *path)


tb_select = partial(tb.select, "Configuration")
# pol_btn = partial(tb.select, "Policy")
nav.add_branch(
    "configuration",
    {
        "configuration_accesscontrol": [
            nav.fn(partial(accordion.click, "Access Control")),
            {
                "cfg_accesscontrol_users": [
                    lambda d: ac_tree("Users"),
                    {"cfg_accesscontrol_user_add": lambda d: tb.select("Configuration", "Add a new User")},
                ],
                "cfg_accesscontrol_user_ed": [
                    lambda ctx: ac_tree("Users", ctx.name),
                    {"cfg_accesscontrol_user_edit": lambda d: tb_select("Edit this User")},
                ],
                "cfg_accesscontrol_groups": [
                    lambda d: ac_tree("Groups"),
                    {"cfg_accesscontrol_group_add": lambda d: tb.select("Configuration", "Add a new Group")},
                ],
                "cfg_accesscontrol_group_ed": [
                    lambda ctx: ac_tree("Groups", ctx.description),
        ("select_value", Select("select#tag_add"))
    ])

tag_table = Table("//div[@id='assignments_div']//table")

group_order_selector = UpDownSelect(
    "select#seq_fields",
    "//img[@alt='Move selected fields up']",
    "//img[@alt='Move selected fields down']")

nav.add_branch(
    'configuration',
    {
        'configuration_accesscontrol':
        [
            nav.fn(partial(accordion.click, "Access Control")),
            {
                'cfg_accesscontrol_users':
                [
                    lambda d: ac_tree("Users"),
                    {
                        'cfg_accesscontrol_user_add':
                        lambda d: tb.select("Configuration", "Add a new User")
                    }
                ],

                'cfg_accesscontrol_user_ed':
                [
                    lambda ctx: ac_tree('Users', ctx.user.name),
                    {
                        'cfg_accesscontrol_user_edit':
Beispiel #8
0
from functools import partial

from selenium.webdriver.common.by import By

import cfme.web_ui.accordion as accordion
import cfme.web_ui.toolbar as tb
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Select, Tree, fill, flash, form_buttons
from cfme.web_ui.menu import nav
from utils.pretty import Pretty
from utils.update import Updateable
from utils.version import LOWEST

assignment_tree = Tree("//div[@id='cb_assignments_treebox']/ul")
tb_select = partial(tb.select, "Configuration")
tb_select_new_chargeback = nav.fn(
    partial(tb_select, "Add a new Chargeback Rate"))
tb_select_edit_chargeback = nav.fn(
    partial(tb_select, "Edit this Chargeback Rate"))


class RateFormItem(Pretty):
    pretty_attrs = ['rate_loc', 'unit_select_loc']

    def __init__(self, rate_loc=None, unit_select_loc=None):
        self.rate_loc = rate_loc
        self.unit_select_loc = unit_select_loc


def _mkitem(index):
    return RateFormItem(
        (By.CSS_SELECTOR, "input#rate_" + str(index)),
Beispiel #9
0
from functools import partial

from selenium.webdriver.common.by import By

import cfme.web_ui.accordion as accordion
import cfme.web_ui.toolbar as tb
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Select, Tree, fill, flash, form_buttons
from cfme.web_ui.menu import nav
from utils.pretty import Pretty
from utils.update import Updateable
from utils.version import LOWEST

assignment_tree = Tree("//div[@id='cb_assignments_treebox']/ul")
tb_select = partial(tb.select, "Configuration")
tb_select_new_chargeback = nav.fn(partial(tb_select, "Add a new Chargeback Rate"))
tb_select_edit_chargeback = nav.fn(partial(tb_select, "Edit this Chargeback Rate"))


class RateFormItem(Pretty):
    pretty_attrs = ['rate_loc', 'unit_select_loc']

    def __init__(self, rate_loc=None, unit_select_loc=None):
        self.rate_loc = rate_loc
        self.unit_select_loc = unit_select_loc


def _mkitem(index):
    return RateFormItem((By.CSS_SELECTOR, "input#rate_" + str(index)),
                        Select((By.CSS_SELECTOR, "select#per_time_" + str(index))))