本文整理汇总了Python中utils.testgen.generate函数的典型用法代码示例。如果您正苦于以下问题:Python generate函数的具体用法?Python generate怎么用?Python generate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VMWrapper
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: test_host_role_association
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)
示例3: current_version
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: current_version
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: a_provider
"""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: current_version
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: tenant
# -*- 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: generate
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: test_credentials_quads
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: vm_name
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: enable_candu
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: create_report
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:
示例13: testing_instance
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
示例14: pytest_generate_tests
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:
示例15: check_labels_in_ui
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.