Пример #1
0
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.cloud.provider.azure import AzureProvider
from cfme import test_requirements
from utils import conf, testgen
from utils.blockers import BZ
from utils.generators import random_vm_name
from utils.hosts import setup_host_creds
from utils.log import logger
from utils.pretty import Pretty
from utils.update import update
from utils.virtual_machines import deploy_template
from utils.wait import wait_for, TimedOutError
from . import do_scan, wait_for_ssa_enabled


pytest_generate_tests = testgen.generate(gen_func=testgen.all_providers, scope="module")

pytestmark = [
    pytest.mark.long_running,
    pytest.mark.meta(blockers=[
        BZ(
            1149128,
            unblock=lambda provider: not provider.one_of(SCVMMProvider))
    ]),
    pytest.mark.meta(server_roles="+automate +smartproxy +smartstate"),
    pytest.mark.tier(2),
    test_requirements.control
]


class VMWrapper(Pretty):
Пример #2
0
import pytest
from random import choice
from selenium.common.exceptions import NoSuchElementException

from cfme.configure.tasks import is_host_analysis_finished
from cfme.infrastructure.deployment_roles import DeploymentRoles
from cfme.infrastructure.host import Host
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from cfme.web_ui import flash, Quadicon, summary_title, toolbar
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.wait import wait_for


pytest_generate_tests = testgen.generate([OpenstackInfraProvider],
                                         scope='module')
pytestmark = [pytest.mark.usefixtures("setup_provider_modscope")]


ROLES = ['NovaCompute', 'Controller', 'Compute', 'BlockStorage', 'SwiftStorage',
         'CephStorage']


def test_host_role_association(provider, soft_assert):
    navigate_to(provider, 'ProviderNodes')
    names = [q.name for q in list(Quadicon.all())]
    for node in names:
        host = Host(node, provider=provider)
        host.run_smartstate_analysis()
        wait_for(is_host_analysis_finished, [host.name], delay=15,
                 timeout="10m", fail_func=toolbar.refresh)
import pytest
import random

from cfme.web_ui import CheckboxTable
from cfme.containers.replicator import Replicator
from utils import testgen
from utils.appliance.implementations.ui import navigate_to
from utils.version import current_version


pytestmark = [
    pytest.mark.uncollectif(lambda provider: current_version() < "5.6" and provider.version > 3.2),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(1)]
pytest_generate_tests = testgen.generate(
    testgen.container_providers, scope='module')

list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")


REPLICATORS_PROPERTIES_FIELDS = ['Name', 'Creation timestamp', 'Resource version',
                                 'Requested pods', 'Current pods']
REPLICATORS_RELATIONSHIPS_FIELDS = ['Containers Provider', 'Project', 'Pods', 'Nodes',
                                    'My Company Tags']


@pytest.fixture(scope="module")
def replicator(provider):
    navigate_to(Replicator, 'All')
    replicator_name = random.choice([r.name.text for r in list_tbl.rows()])
    return Replicator(replicator_name, provider)
Пример #4
0
import pytest
from cfme.middleware.server import MiddlewareServer
from utils import testgen
from utils.version import current_version

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["hawkular"], scope="function")


def test_list_servers():
    """Tests servers lists between UI, DB and Management system.

    Steps:
        * Get servers list from UI
        * Get servers list from Database
        * Get headers from UI
        * Compare headers from UI with expected headers list
        * Compare content of all the list [UI, Database, Management system]
    """
    ui_servers = _get_servers_set(MiddlewareServer.servers())
    db_servers = _get_servers_set(MiddlewareServer.servers_in_db())
    mgmt_servers = _get_servers_set(MiddlewareServer.servers_in_mgmt())
    headers = MiddlewareServer.headers()
    headers_expected = ['Server Name', 'Product', 'Host Name', 'Feed', 'Provider']
    assert headers == headers_expected
    assert ui_servers == db_servers == mgmt_servers, \
        ("Lists of servers mismatch! UI:{}, DB:{}, MGMT:{}"
         .format(ui_servers, db_servers, mgmt_servers))
Пример #5
0
"""This module contains REST API specific tests."""
import fauxfactory
import pytest

from cfme import Credential
from cfme.configure.access_control import User, Group
from cfme.login import login
from cfme.rest import vm as _vm
from utils.providers import setup_a_provider as _setup_a_provider
from utils.version import current_version
from utils import testgen, conf, version


pytest_generate_tests = testgen.generate(
    testgen.provider_by_type,
    ['virtualcenter', 'rhevm'],
    scope="module"
)


@pytest.fixture(scope="module")
def a_provider():
    return _setup_a_provider("infra")


@pytest.mark.usefixtures("logged_in")
@pytest.fixture(scope='function')
def user():
    user = User(credential=Credential(principal=fauxfactory.gen_alphanumeric(),
        secret=fauxfactory.gen_alphanumeric()), name=fauxfactory.gen_alphanumeric(),
        group=Group(description='EvmGroup-super_administrator'))
Пример #6
0
from cfme.middleware.provider.hawkular import HawkularProvider
from cfme.middleware.server import MiddlewareServer
from cfme.web_ui import flash
from utils import testgen
from utils.version import current_version
from server_methods import verify_server_running, verify_server_stopped
from server_methods import get_servers_set, verify_server_suspended
from server_methods import get_eap_server, get_hawkular_server
from server_methods import verify_server_starting, verify_server_stopping
from server_methods import get_eap_container_server

pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]
pytest_generate_tests = testgen.generate([HawkularProvider], scope="function")


@pytest.yield_fixture(scope="function")
def server(provider):
    server = get_eap_server(provider)
    yield server
    server.restart_server()


def test_list_servers():
    """Tests servers lists between UI, DB and Management system.

    Steps:
        * Get servers list from UI
        * Get servers list from Database
Пример #7
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest

from cfme.cloud.tenant import Tenant
from utils import testgen

pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["openstack"], scope="module")


@pytest.fixture
def tenant(provider_key):
    return Tenant(
        name=fauxfactory.gen_alphanumeric(8), description=fauxfactory.gen_alphanumeric(8), provider_key=provider_key
    )


def test_tenant(provider_mgmt, tenant, provider_key):
    """ Tests tenant (currently disabled)

    Metadata:
        test_flag: tenant
    """
    print tenant.name, tenant.description, provider_key
Пример #8
0
import pytest

from cfme.infrastructure import pxe
from utils.update import update
from utils.testgen import generate, pxe_servers


pytest_generate_tests = generate(pxe_servers)


@pytest.fixture(scope='function')
def has_no_pxe_servers():
    pxe.remove_all_pxe_servers()


@pytest.mark.usefixtures('has_no_pxe_servers')
def test_pxe_server_crud(pxe_name, pxe_server_crud):
    """
    Basic Add test for PXE server including refresh.
    """
    pxe_server_crud.create()
    with update(pxe_server_crud):
        pxe_server_crud.name = pxe_server_crud.name + "_update"
    pxe_server_crud.delete(cancel=False)
Пример #9
0
import pytest
from utils import testgen
from cfme.web_ui import Quadicon
from cfme.fixtures import pytest_selenium as sel


pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         ['openstack-infra'],
                                         scope='module')


@pytest.mark.usefixtures("setup_provider_modscope")
def test_credentials_quads(provider):
    provider.load_details()
    sel.force_navigate("infrastructure_providers")
    quad = Quadicon(provider.name, qtype='infra_prov')
    checked = str(quad.creds).split('-')[0]
    assert checked == 'checkmark'
Пример #10
0
from cfme.automate.simulation import simulate
from cfme.common.vm import VM
from cfme.fixtures import pytest_selenium as sel
from cfme.infrastructure.virtual_machines import Vm  # For Vm.Snapshot
from utils import testgen
from utils.conf import credentials
from utils.log import logger
from utils.path import data_path
from utils.ssh import SSHClient
from utils.wait import wait_for


pytestmark = [pytest.mark.long_running]


pytest_generate_tests = testgen.generate(testgen.infra_providers, 'full_template', scope="module")


@pytest.fixture(scope="module")
def vm_name():
    return "test_snpsht_" + fauxfactory.gen_alphanumeric()


@pytest.fixture(scope="module")
def domain(request):
    dom = Domain(fauxfactory.gen_alpha(), enabled=True)
    dom.create()
    request.addfinalizer(dom.delete)
    return dom

Пример #11
0
from cfme.middleware.provider import MiddlewareProvider
from cfme.exceptions import FlashMessageException
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version


# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate([ContainersProvider, MiddlewareProvider], scope="module")


pytestmark = [
    pytest.mark.tier(1),
    test_requirements.c_and_u
]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
Пример #12
0
import utils.error as error
from cfme.middleware.provider.hawkular import HawkularProvider
from cfme.web_ui import fill, flash, form_buttons
from cfme.fixtures import pytest_selenium as sel
from cfme.exceptions import FlashMessageException
from utils import testgen
from utils.update import update
from utils.version import current_version
from utils.appliance.implementations.ui import navigate_to


pytestmark = [
    pytest.mark.uncollectif(lambda: current_version() < '5.7'),
]

pytest_generate_tests = testgen.generate(testgen.middleware_providers, scope="function")


@pytest.mark.usefixtures('has_no_middleware_providers')
def test_provider_add_with_bad_credentials(provider):
    """ Tests provider add with bad credentials"""
    provider.credentials['default'] = provider.Credential(
        principal='bad',
        secret='reallybad'
    )
    with error.expected('Credential validation was not successful: Invalid credentials'):
        provider.create(validate_credentials=True)
    assert (not provider.add_provider_button.can_be_clicked)


def test_add_cancelled_validation():
Пример #13
0
from cfme import test_requirements
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.intelligence.reports.reports import CannedSavedReport
from utils import testgen
from utils.blockers import BZ
from utils.log import logger

pytestmark = [pytest.mark.tier(3),
              test_requirements.report,
              pytest.mark.usefixtures('setup_provider')]

pytest_generate_tests = testgen.generate(
    [OpenStackProvider, EC2Provider, RHEVMProvider, VMwareProvider],
    scope='module')


@pytest.yield_fixture(scope='module')
def create_report():
    # TODO parameterize on path, for now test infrastructure reports
    path = ["Configuration Management", "Hosts", "Virtual Infrastructure Platforms"]
    report = CannedSavedReport.new(path)
    report_time = report.datetime
    logger.debug('Created report for path {} and time {}'.format(path, report_time))
    yield report

    try:
        report.delete()
    except Exception:
Пример #14
0
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.services import requests
from utils import normalize_text, testgen
from utils.rest import assert_response
from utils.generators import random_vm_name
from utils.log import logger
from utils.update import update
from utils.version import current_version
from utils.wait import wait_for, RefreshTimer

pytestmark = [pytest.mark.meta(server_roles="+automate"),
              test_requirements.provision, pytest.mark.tier(2)]


pytest_generate_tests = testgen.generate(
    [CloudProvider], required_fields=[['provisioning', 'image']], scope="function")


@pytest.yield_fixture(scope="function")
def testing_instance(request, setup_provider, provider, provisioning, vm_name):
    """ Fixture to prepare instance parameters for provisioning
    """
    image = provisioning['image']['name']
    note = ('Testing provisioning from image {} to vm {} on provider {}'.format(
        image, vm_name, provider.key))

    instance = Instance.factory(vm_name, provider, image)

    inst_args = dict()

    # Base instance info
from cfme.configure import configuration as conf
from selenium.common.exceptions import WebDriverException
from cfme.infrastructure.provider import wait_for_a_provider
import cfme.fixtures.pytest_selenium as sel
from time import sleep
from urlparse import urlparse
from utils import db, testgen, version
from utils.appliance import provision_appliance
from utils.conf import credentials
from utils.log import logger
from utils.ssh import SSHClient
from utils.wait import wait_for

pytestmark = [pytest.mark.long_running]

pytest_generate_tests = testgen.generate(testgen.infra_providers, scope="module")

random_vm_test = []


def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.provider_by_type(
        metafunc, ['virtualcenter'], choose_random=True)
    if not idlist:
        return
    new_idlist = []
    new_argvalues = []
    if 'random_pwr_ctl_vm' in metafunc.fixturenames:
        if random_vm_test:
            argnames, new_argvalues, new_idlist = random_vm_test
        else:
Пример #16
0
from cfme.containers.image import Image
from cfme.containers.project import Project
from cfme.containers.route import Route
from cfme.containers.template import Template
from cfme.exceptions import SetLabelException

from utils import testgen
from utils.wait import wait_for
from utils.log import logger
from utils.blockers import BZ


pytestmark = [
    pytest.mark.usefixtures('setup_provider_modscope'),
    pytest.mark.tier(1)]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='module')


TEST_OBJECTS = (Pod, Service, Route, Template, Node, Replicator, Image, Project)


def check_labels_in_ui(instance, name, expected_value):
    if hasattr(instance.summary, 'labels') and \
            hasattr(instance.summary.labels, name.lower()):
        return getattr(instance.summary.labels, name.lower()).text_value == str(expected_value)
    return False


@pytest.fixture(scope='module')
def random_labels(provider, appliance):
    # Creating random instance for each object in TEST_OBJECTS and create a random label for it.
from utils import testgen
from utils.log import logger
from utils.wait import wait_for

pytestmark = [
    test_requirements.service,
    pytest.mark.usefixtures("vm_name"),
    pytest.mark.usefixtures("catalog_item"),
    pytest.mark.usefixtures("uses_infra_providers"),
    pytest.mark.long_running,
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.tier(3),
]


pytest_generate_tests = testgen.generate(testgen.provider_by_type, ["virtualcenter"], scope="module")


@pytest.fixture(scope="function")
def copy_domain(request):
    domain = Domain(name=fauxfactory.gen_alphanumeric(), enabled=True)
    domain.create()
    request.addfinalizer(lambda: domain.delete() if domain.exists() else None)
    return domain


@pytest.yield_fixture(scope="function")
def myservice(setup_provider, provider, catalog_item, request):
    vm_name = catalog_item.provisioning_data["vm_name"]
    request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
    catalog_item.create()
Пример #18
0
import pytest

from cfme.configure.access_control import simple_user
from cfme.login import login, login_admin
from utils.conf import credentials
from utils.testgen import auth_groups, generate
from utils import version
from utils.providers import setup_a_provider

pytest_generate_tests = generate(auth_groups, auth_mode='aws_iam')


@pytest.fixture(scope="module")
def setup_first_provider():
    setup_a_provider(validate=True, check_existing=True)


@pytest.mark.uncollect('Needs to be fixed after menu removed')
@pytest.mark.tier(2)
def test_group_roles(
        request, configure_aws_iam_auth_mode, group_name, group_data, setup_first_provider):
    """Basic default AWS_IAM group role RBAC test

    Validates expected menu and submenu names are present for default
    AWS IAM groups

    """
    request.addfinalizer(login_admin)

    # This should be removed but currently these roles are subject to a bug
    if version.current_version() >= '5.4' and group_name in ['evmgroup-administrator',
import pytest

from cfme.containers.provider import ContainersProvider
from utils import testgen, version
from cfme.web_ui import toolbar as tb
from utils.appliance.implementations.ui import navigate_to


pytestmark = [
    pytest.mark.uncollectif(
        lambda: version.current_version() < "5.6"),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(2)]
pytest_generate_tests = testgen.generate([ContainersProvider], scope='function')


@pytest.mark.polarion('CMP-9878')
def test_reload_button_provider(provider):
    """ This test verifies the data integrity of the fields in
        the Relationships table after clicking the "reload"
        button. Fields that are being verified as part of provider.validate.stats():
        Projects, Routes, Container Services, Replicators, Pods, Containers, and Nodes.
        Images are being validated separately, since the total
        number of images in CFME 5.7 includes all images from the OSE registry as well
        as the images that are being created from the running pods. The images are searched
        according to the @sha. Image Registries are also validated separately.
    """

    navigate_to(provider, 'Details')
    tb.select('Reload Current Display')
    provider.validate_stats(ui=True)
Пример #20
0
import fauxfactory
import pytest
from cfme.cloud.provider.openstack import OpenStackProvider
from utils.update import update
from cfme.cloud.tenant import Tenant
from utils import testgen
from utils.log import logger
from utils.version import current_version


pytest_generate_tests = testgen.generate([OpenStackProvider], scope='module')


@pytest.yield_fixture(scope='function')
def tenant(provider, setup_provider):
    tenant = Tenant(name=fauxfactory.gen_alphanumeric(8), provider=provider)

    yield tenant

    try:
        if tenant.exists:
            tenant.delete()

    except Exception:
        logger.warning(
            'Exception while attempting to delete tenant fixture, continuing')
    finally:
        if tenant.name in provider.mgmt.list_tenant():
            provider.mgmt.remove_tenant(tenant.name)

Пример #21
0
from cfme.configure.configuration import VMwareConsoleSupport
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.configure import configuration
from cfme.common.vm import VM
from utils import testgen, version, ssh
from utils.appliance.implementations.ui import navigate_to
from utils.log import logger
from utils.conf import credentials
from utils.providers import ProviderFilter
from wait_for import wait_for

pytestmark = pytest.mark.usefixtures('setup_provider')

pytest_generate_tests = testgen.generate(
    gen_func=testgen.providers,
    filters=[ProviderFilter(classes=[CloudInfraProvider], required_flags=['html5_console'])],
    scope='module'
)


@pytest.fixture(scope="function")
def vm_obj(request, provider, setup_provider, console_template, vm_name):
    """
    Create a VM on the provider with the given template, and return the vm_obj.

    Also, it will remove VM from provider using nested function _delete_vm
    after the test is completed.

    """
    vm_obj = VM.factory(vm_name, provider, template_name=console_template)
Пример #22
0
from cfme.common.provider import BaseProvider
from cfme.exceptions import FlashMessageException
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from utils.version import current_version


# Tests for vmware,rhev, openstack, ec2, azure, gce providers have been moved to
# cfme/tests/test_utilization_metrics.py.
# Also, this test just verifies that C&U/perf data is being collected, whereas the tests in
# test_utilization_metrics.py go a step further and verify that specific performance metrics are
# being collected.Eventually, support should be added to verify that specific metrics are being
# collected for *all* providers.
pytest_generate_tests = testgen.generate(testgen.provider_by_type, [
    'container', 'middleware'], scope="module")


pytestmark = [
    pytest.mark.tier(1),
    test_requirements.c_and_u
]


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
Пример #23
0
import pytest

import utils.error as error
import cfme.fixtures.pytest_selenium as sel
from cfme import Credential
from cfme.exceptions import FlashMessageException
from cfme.cloud.provider import (discover, wait_for_a_provider,
    CloudProvider, prop_region)
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.web_ui import fill, flash
from utils import testgen, version, providers
from utils.appliance.implementations.ui import navigate_to
from utils.update import update
from cfme import test_requirements
pytest_generate_tests = testgen.generate(testgen.cloud_providers, scope="function")


@pytest.fixture(scope="module")
def setup_a_provider():
    return providers.setup_a_provider(prov_class="cloud", validate=True, check_existing=True)


@pytest.mark.tier(3)
@test_requirements.discovery
def test_empty_discovery_form_validation():
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None, d_type="Amazon")
    ident = version.pick({version.LOWEST: 'User ID',
                          '5.4': 'Username'})
    flash.assert_message_match('{} is required'.format(ident))
Пример #24
0
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.cloud.instance import instance_factory, details_page
from cfme.web_ui import toolbar, jstimelines
from utils import testgen
from utils.log import logger
from cfme.exceptions import ToolbarOptionGreyed
from utils.wait import wait_for

pytestmark = [pytest.mark.ignore_stream("5.2")]
# bz1127960 = pytest.mark.bugzilla(
#    1127960, unskip={1127960: lambda appliance_version: appliance_version >= "5.3"})


pytest_generate_tests = testgen.generate(testgen.provider_by_type,
                                         provider_types=['openstack'], scope="module")


@pytest.fixture(scope="module")
def delete_fx_provider_event(db, provider_crud):
    logger.debug("Deleting timeline events for provider name {}".format(provider_crud.name))
    ems = db['ext_management_systems']
    ems_events = db['ems_events']
    with db.transaction:
        providers = (
            db.session.query(ems_events.id)
            .join(ems, ems_events.ems_id == ems.id)
            .filter(ems.name == provider_crud.name)
        )
        db.session.query(ems_events).filter(ems_events.id.in_(providers.subquery())).delete(False)
Пример #25
0
import pytest
import time
from utils import db
from utils import providers
from utils import testgen
from utils import conf
from utils.log import logger
from cfme.configure.configuration import server_roles_enabled, candu
from cfme.exceptions import FlashMessageException

pytest_generate_tests = testgen.generate(testgen.provider_by_type, None)


@pytest.yield_fixture(scope="module")
def enable_candu():
    try:
        with server_roles_enabled(
                'ems_metrics_coordinator', 'ems_metrics_collector', 'ems_metrics_processor'):
            candu.enable_all()
            yield
    finally:
        candu.disable_all()


# blow away all providers when done - collecting metrics for all of them is
# too much
@pytest.yield_fixture
def handle_provider(provider):
    try:
        providers.clear_providers()
        providers.setup_provider(provider.key)
Пример #26
0
import pytest

import cfme.web_ui.flash as flash
import utils.error as error
import cfme.fixtures.pytest_selenium as sel
from cfme.common.provider import BaseProvider
from cfme.exceptions import FlashMessageException
from cfme.infrastructure.provider import discover, wait_for_a_provider, InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from utils import testgen, providers, version
from utils.update import update
from utils.api import APIException
from cfme import test_requirements

pytest_generate_tests = testgen.generate(testgen.infra_providers, scope="function")


@pytest.fixture(scope="module")
def setup_a_provider():
    return providers.setup_a_provider(prov_class="infra", validate=True, check_existing=True)


@pytest.mark.tier(3)
@pytest.mark.sauce
@test_requirements.discovery
def test_empty_discovery_form_validation():
    """ Tests that the flash message is correct when discovery form is empty."""
    discover(None)
    flash.assert_message_match('At least 1 item must be selected for discovery')
Пример #27
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from random import choice

from utils import testgen, version
from utils.miq_soap import MiqVM, set_client
from utils.providers import setup_a_provider as _setup_a_provider

pytest_generate_tests = testgen.generate(
    testgen.infra_providers,
    scope="class"
)

pytestmark = [
    pytest.mark.ignore_stream("5.5", "upstream"),
    pytest.mark.uncollectif(lambda: version.current_version() >= "5.6"),
    pytest.mark.tier(3)
]


@pytest.fixture(scope="class")
def setup_a_provider():
    _setup_a_provider("infra")


@pytest.mark.usefixtures("setup_a_provider")
class TestSoapBasicInteraction(object):
    def test_connectivity(self, soap_client):
        """Tests soap
Пример #28
0
import pytest

from cfme.login import login
from cfme.web_ui import menu
from utils.conf import credentials
from utils.testgen import auth_groups, generate

pytest_generate_tests = generate(auth_groups, auth_mode='ldap')


def test_group_roles(configure_ldap_auth_mode, group_name, group_data):
    """Basic default LDAP group role RBAC test

    Validates expected menu and submenu names are present for default
    LDAP group roles

    """
    try:
        username = credentials[group_name]['username']
        password = credentials[group_name]['password']
    except KeyError:
        pytest.fail('No match in credentials file for group "%s"' % group_name)

    login(username, password)
    assert set(menu.visible_pages()) == set(group_data)
Пример #29
0
from cfme.containers.service import Service
from cfme.containers.route import Route
from cfme.containers.project import Project
from cfme.containers.provider import ContainersProvider
from random import choice
from cfme.web_ui import breadcrumbs
from collections import namedtuple
from cfme.web_ui import toolbar as tb


pytestmark = [
    pytest.mark.uncollectif(lambda: current_version() < "5.6"),
    pytest.mark.usefixtures("setup_provider"),
    pytest.mark.tier(1),
]
pytest_generate_tests = testgen.generate(testgen.container_providers, scope="function")

# CMP_9903  CMP_9904  CMP_9905  CMP_9906

DataSet = namedtuple("DataSet", ["object", "breadcrumb_member"])

DATA_SETS = [
    DataSet(Service, "Container Services"),
    DataSet(Route, "Routes"),
    DataSet(Project, "Projects"),
    DataSet(ContainersProvider, "Containers Providers"),
]


@pytest.mark.parametrize(("cls"), DATA_SETS, ids=[cls.object.__name__ for cls in DATA_SETS])
def test_summary_pages_links(provider, cls):
Пример #30
0
from utils.datafile import load_data_file
from utils.log import logger
from utils.wait import wait_for


pytestmark = [
    pytest.mark.meta(server_roles="+automate"),
    pytest.mark.ignore_stream("upstream"),
    test_requirements.stack,
    pytest.mark.tier(2)
]


pytest_generate_tests = testgen.generate(
    [CloudProvider], required_fields=[
        ['provisioning', 'stack_provisioning']
    ],
    scope="module")


@pytest.yield_fixture(scope="function")
def template(provider, provisioning, dialog_name, setup_provider):
    template_type = provisioning['stack_provisioning']['template_type']
    template_name = fauxfactory.gen_alphanumeric()
    template = OrchestrationTemplate(template_type=template_type,
                                     template_name=template_name)

    if provider.type == "ec2":
        data_file = load_data_file(str(orchestration_path.join('aws_vm_template.json')))
    elif provider.type == "openstack":
        data_file = load_data_file(str(orchestration_path.join('openstack_vm_template.data')))