def test_filter_with_user_input_and_cancellation(single_provider):
    # Set up the filter
    search.fill_and_apply_filter(
        "fill_count(Infrastructure Provider.VMs, >=)", fill_callback={"COUNT": 0},
        cancel_on_user_filling=True
    )
    assert_no_cfme_exception()
def test_filter_with_user_input_and_cancellation():
    # Set up the filter
    search.fill_and_apply_filter(
        "fill_count(Infrastructure Provider.VMs, >=)", fill_callback={"COUNT": 0},
        cancel_on_user_filling=True
    )
    assert_no_cfme_exception()
def test_quick_search_without_filter(request, single_provider):
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_filter_save_and_load_cancel(request, providers, ssh_client):
    pytest.sel.force_navigate("infrastructure_providers")
    filter_name = fauxfactory.gen_alphanumeric()
    # Set up finalizer
    request.addfinalizer(
        lambda: ssh_client.run_rails_command(
            "\"MiqSearch.where(:description => {}).first.delete\"".format(repr(filter_name))))
    # Try save filter
    search.save_filter("fill_count(Infrastructure Provider.VMs, >)", filter_name)

    @request.addfinalizer
    def cleanup():
        pytest.sel.force_navigate("infrastructure_providers")
        search.load_filter(filter_name)
        search.delete_filter()

    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(
        filter_name,
        fill_callback={"COUNT": 0},
        cancel_on_user_filling=True
    )
    assert_no_cfme_exception()
def test_filter_with_user_input_and_cancellation(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm

    # Set up the filter
    search.fill_and_apply_filter(get_expression(True), {"COUNT": median_vm_count}, cancel_on_user_filling=True)
    assert_no_cfme_exception()
def test_quick_search_without_filter(request):
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
예제 #7
0
def test_filter_with_user_input_and_cancellation(providers):
    sel.force_navigate("infrastructure_providers")
    # Set up the filter
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=)",
                                 {"COUNT": 0},
                                 cancel_on_user_filling=True)
    assert_no_cfme_exception()
def test_filter_save_cancel(vms, subset_of_vms, expression_for_vms_subset):
    pytest.sel.force_navigate("infra_vms")
    filter_name = fauxfactory.gen_alphanumeric()
    # Set up the filter
    search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name, cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(pytest.sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
def test_filter_with_user_input_and_cancellation(vms, subset_of_vms, expression_for_vms_subset):
    pytest.sel.force_navigate("infra_vms")
    vm = sample(subset_of_vms, 1)[0]
    # Set up the filter
    search.fill_and_apply_filter(
        "fill_field(Virtual Machine : Name, =)", {"Virtual Machine": vm}, cancel_on_user_filling=True
    )
    assert_no_cfme_exception()
def test_quick_search_with_filter(request):
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=, 0)")
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_quick_search_with_filter(request, single_provider):
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=, 0)")
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_filter_with_user_input_and_cancellation(providers):
    pytest.sel.force_navigate("infrastructure_providers")
    # Set up the filter
    search.fill_and_apply_filter(
        "fill_count(Infrastructure Provider.VMs, >=)", {"COUNT": 0},
        cancel_on_user_filling=True
    )
    assert_no_cfme_exception()
예제 #13
0
def test_filter_save_cancel(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    filter_name = generate_random_string()
    # Try save filter
    search.save_filter("fill_count(Host.VMs, >)", filter_name, cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
예제 #14
0
def test_filter_without_user_input(hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter(get_expression(False).format(median_vm_count))
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host.get_all_hosts(do_not_navigate=True))
예제 #15
0
def test_filter_without_user_input(hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter(get_expression(False).format(median_vm_count))
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host.get_all_hosts(do_not_navigate=True))
def test_quick_search_without_filter(request, providers):
    pytest.sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_quick_search_with_filter(request, providers):
    sel.force_navigate("infrastructure_providers")
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=, 0)")
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(generate_random_string())
    assert_no_cfme_exception()
def test_filter_without_user_input(hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter(get_expression(False).format(median_vm_count))
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host.get_all_hosts())
예제 #19
0
def test_filter_save_cancel(hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    filter_name = fauxfactory.gen_alphanumeric()
    # Try save filter
    search.save_filter(get_expression(True), filter_name, cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(pytest.sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
def test_filter_with_user_input_and_cancellation(vms, subset_of_vms,
                                                 expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    vm = sample(subset_of_vms, 1)[0]
    # Set up the filter
    search.fill_and_apply_filter("fill_field(Virtual Machine : Name, =)",
                                 {"Virtual Machine": vm},
                                 cancel_on_user_filling=True)
    assert_no_cfme_exception()
예제 #21
0
def test_quick_search_without_filter(request, providers):
    sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
예제 #22
0
def test_filter_save_cancel(hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    filter_name = fauxfactory.gen_alphanumeric()
    # Try save filter
    search.save_filter(get_expression(True), filter_name, cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(pytest.sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
예제 #23
0
def test_filter_with_user_input_and_cancellation(vms, subset_of_vms,
                                                 expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    vm = pick(subset_of_vms, 1)[0]
    # Set up the filter
    search.fill_and_apply_filter("fill_field(Virtual Machine : Name, =)",
                                 {"Virtual Machine": vm},
                                 cancel_on_user_filling=True)
    assert_no_cfme_exception()
def test_filter_without_user_input(vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    # Set up the filter
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    vms_present = virtual_machines.get_all_vms(do_not_navigate=True)
    for vm in subset_of_vms:
        if vm not in vms_present:
            pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_filter_with_user_input(vms, subset_of_vms, expression_for_vms_subset):
    pytest.sel.force_navigate("infra_vms")
    vm = sample(subset_of_vms, 1)[0]
    # Set up the filter
    search.fill_and_apply_filter("fill_field(Virtual Machine : Name, =)", {"Virtual Machine": vm})
    assert_no_cfme_exception()
    vms_present = virtual_machines.get_all_vms(do_not_navigate=True)
    if vm not in vms_present:
        pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_filter_save_cancel(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    filter_name = generate_random_string()
    # Try save filter
    search.save_filter("fill_count(Host.VMs, >)", filter_name, cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
def test_filter_without_user_input(vms, subset_of_vms,
                                   expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    # Set up the filter
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    vms_present = virtual_machines.get_all_vms(do_not_navigate=True)
    for vm in subset_of_vms:
        if vm not in vms_present:
            pytest.fail("Could not find VM {} after filtering!".format(vm))
예제 #28
0
def test_filter_with_user_input_and_cancellation(hosts, hosts_with_vm_count,
                                                 host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm

    # Set up the filter
    search.fill_and_apply_filter("fill_count(Host.VMs, >)",
                                 {"COUNT": median_vm_count},
                                 cancel_on_user_filling=True)
    assert_no_cfme_exception()
def test_filter_with_user_input_and_cancellation(hosts, hosts_with_vm_count,
                                                 host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm

    # Set up the filter
    search.fill_and_apply_filter(get_expression(True),
                                 {"COUNT": median_vm_count},
                                 cancel_on_user_filling=True)
    assert_no_cfme_exception()
예제 #30
0
def test_filter_save_cancel(vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    filter_name = generate_random_string()
    # Set up the filter
    search.save_filter("fill_field(Virtual Machine : Name, =)",
                       filter_name,
                       cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
def test_filter_save_cancel(vms, subset_of_vms, expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    filter_name = fauxfactory.gen_alphanumeric()
    # Set up the filter
    search.save_filter("fill_field(Virtual Machine : Name, =)",
                       filter_name,
                       cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(search.DisabledButtonException):
        search.load_filter(filter_name)  # does not exist
def test_filter_with_user_input(vms, subset_of_vms, expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    vm = sample(subset_of_vms, 1)[0]
    # Set up the filter
    search.fill_and_apply_filter("fill_field(Virtual Machine : Name, =)",
                                 {"Virtual Machine": vm})
    assert_no_cfme_exception()
    vms_present = virtual_machines.get_all_vms(do_not_navigate=True)
    if vm not in vms_present:
        pytest.fail("Could not find VM {} after filtering!".format(vm))
예제 #33
0
def test_quick_search_without_filter(vms, subset_of_vms):
    sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = pick(subset_of_vms, 1)[0]
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
예제 #34
0
def test_quick_search_without_filter(vms, subset_of_vms):
    sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = pick(subset_of_vms, 1)[0]
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
예제 #35
0
def test_filter_with_user_input(host_collection, hosts, hosts_with_vm_count, host_with_median_vm,
                                infra_provider):
    navigate_to(host_collection, 'All')
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))

    # Set up the filter
    search.fill_and_apply_filter(get_expression(True), {"COUNT": median_vm_count})
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host_collection.all(infra_provider))
예제 #36
0
def test_quick_search_with_filter(vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Filter this host only
    chosen_vm = pick(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_quick_search_without_filter(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_filter_with_user_input_and_cancellation(hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm

    # Set up the filter
    search.fill_and_apply_filter(
        get_expression(True),
        {"COUNT": median_vm_count},
        cancel_on_user_filling=True
    )
    assert_no_cfme_exception()
예제 #39
0
def test_quick_search_with_filter(vms, subset_of_vms,
                                  expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Filter this host only
    chosen_vm = pick(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_filter_save_cancel(request, providers, ssh_client):
    pytest.sel.force_navigate("infrastructure_providers")
    filter_name = fauxfactory.gen_alphanumeric()
    # Set up finalizer
    request.addfinalizer(
        lambda: ssh_client.run_rails_command(
            "\"MiqSearch.where(:description => {}).first.delete\"".format(repr(filter_name))))
    # Try save filter
    search.save_filter("fill_count(Infrastructure Provider.VMs, >)", filter_name, cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(pytest.sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
def test_filter_save_cancel(vms, subset_of_vms, expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    filter_name = fauxfactory.gen_alphanumeric()
    # Set up the filter
    search.save_filter(
        "fill_field(Virtual Machine : Name, =)",
        filter_name,
        cancel=True
    )
    assert_no_cfme_exception()
    with pytest.raises(search.DisabledButtonException):
        search.load_filter(filter_name)  # does not exist
예제 #42
0
def test_quick_search_without_filter(hosts, hosts_with_vm_count,
                                     host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
예제 #43
0
def test_filter_without_user_input(hosts, hosts_with_vm_count,
                                   host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(
        dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter("fill_count(Host.VMs, >, %d)" %
                                 median_vm_count)
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(
        host.get_all_hosts(do_not_navigate=True))
예제 #44
0
def test_quick_search_with_filter(hosts, hosts_with_vm_count,
                                  host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter("fill_count(Host.VMs, >=, %d)" %
                                 median_vm_count)
    assert_no_cfme_exception()
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_without_filter(request, vms, subset_of_vms):
    navigate_to(Vm, 'VMsOnly')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = sample(subset_of_vms, 1)[0]
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_without_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts()
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_with_filter(request, vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    chosen_vm = sample(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_quick_search_without_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_filter_save_and_load(request, vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    filter_name = fauxfactory.gen_alphanumeric()
    vm = sample(subset_of_vms, 1)[0]
    # Set up the filter
    search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name, fill_callback={"Virtual Machine": vm})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
    assert vm in virtual_machines.get_all_vms(do_not_navigate=True)
예제 #50
0
def test_quick_search_without_filter(request, vms, subset_of_vms):
    pytest.sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = sample(subset_of_vms, 1)[0]
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_with_filter(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(
        "fill_count(Host.VMs, >=, %d)" % median_vm_count
    )
    assert_no_cfme_exception()
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
예제 #52
0
def test_quick_search_with_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(get_expression(False, ">=").format(median_vm_count))
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
예제 #53
0
def test_quick_search_with_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(get_expression(False, ">=").format(median_vm_count))
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
예제 #54
0
def test_filter_save_cancel(request, providers, ssh_client):
    sel.force_navigate("infrastructure_providers")
    filter_name = fauxfactory.gen_alphanumeric()
    # Set up finalizer
    request.addfinalizer(lambda: ssh_client.run_rails_command(
        "\"MiqSearch.where(:description => {}).first.delete\"".format(
            repr(filter_name))))
    # Try save filter
    search.save_filter("fill_count(Infrastructure Provider.VMs, >)",
                       filter_name,
                       cancel=True)
    assert_no_cfme_exception()
    with pytest.raises(sel.NoSuchElementException):
        search.load_filter(filter_name)  # does not exist
def test_quick_search_with_filter(request, vms, subset_of_vms,
                                  expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    chosen_vm = sample(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_filter_save_cancel(single_provider, rails_delete_filter):
    # bind filter_name to the function for fixture cleanup
    test_filter_save_cancel.filter_name = fauxfactory.gen_alphanumeric()
    logger.debug('Set filter_name to: {}'.format(test_filter_save_cancel.filter_name))

    # Try save filter
    assert search.save_filter("fill_count(Infrastructure Provider.VMs, >)",
                              test_filter_save_cancel.filter_name, cancel=True)
    assert_no_cfme_exception()

    assert search.reset_filter()
    # Exception depends on system state - Load button will be disabled if there are no saved filters
    with pytest.raises((DisabledButtonException, NoSuchElementException)):
        search.load_filter(saved_filter=test_filter_save_cancel.filter_name)
def test_filter_save_cancel(rails_delete_filter):
    # bind filter_name to the function for fixture cleanup
    test_filter_save_cancel.filter_name = fauxfactory.gen_alphanumeric()
    logger.debug('Set filter_name to: {}'.format(test_filter_save_cancel.filter_name))

    # Try save filter
    assert search.save_filter("fill_count(Infrastructure Provider.VMs, >)",
                              test_filter_save_cancel.filter_name, cancel=True)
    assert_no_cfme_exception()

    assert search.reset_filter()
    # Exception depends on system state - Load button will be disabled if there are no saved filters
    with pytest.raises((DisabledButtonException, NoSuchElementException)):
        search.load_filter(saved_filter=test_filter_save_cancel.filter_name)
def test_filter_save_and_load(request, providers, ssh_client):
    sel.force_navigate("infrastructure_providers")
    filter_name = generate_random_string()
    # Set up finalizer
    request.addfinalizer(
        lambda: ssh_client.run_rails_command(
            "\"MiqSearch.where(:description => {}).first.delete\"".format(repr(filter_name))))
    # Try save filter
    search.save_filter("fill_count(Infrastructure Provider.VMs, >)", filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name, fill_callback={"COUNT": 0})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
예제 #59
0
def test_filter_save_and_load(request, vms, subset_of_vms,
                              expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    filter_name = generate_random_string()
    vm = pick(subset_of_vms, 1)[0]
    # Set up the filter
    search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name,
                                 fill_callback={"Virtual Machine": vm})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
    assert vm in virtual_machines.get_all_vms(do_not_navigate=True)
def test_filter_save_and_load(request, vms, subset_of_vms,
                              expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    filter_name = fauxfactory.gen_alphanumeric()
    vm = sample(subset_of_vms, 1)[0]
    # Set up the filter
    search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name,
                                 fill_callback={"Virtual Machine": vm})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
    assert vm in virtual_machines.get_all_vms(do_not_navigate=True)