def test_virsh_output():
    output = virsh_list_all.VirshListAll(context_wrap(OUTPUT))
    assert len(output.search(state='shut off')) == 11
    assert len(output.search(id=None)) == 11
    assert len(output.search(id=2)) == 1
    assert output.search(name='rhel7.4') == [{'state': 'running', 'id': 2, 'name': 'rhel7.4'}]
    assert output.get_vm_state('rhel7.0') == 'paused'
    assert output.get_vm_state('rhel9.0') is None
    assert ('cfme' in output) is False
    assert ('cfme-5.7.13' in output) is True
    assert output.get_vm_state("RHOSP10") == "shut off"
예제 #2
0
def test_virsh_list_all_documentation():
    failed_count, tests = doctest.testmod(
        virsh_list_all,
        globs={'output': virsh_list_all.VirshListAll(context_wrap(OUTPUT))})
    assert failed_count == 0
예제 #3
0
def test_virsh_output_blank():
    output = virsh_list_all.VirshListAll(context_wrap(BLANK))
    assert output.fields == []
    assert output.cols == []
    assert output.keywords == []
    assert output.get_vm_state('NORHEL') is None
예제 #4
0
def test_virsh_output_no_vms():
    output = virsh_list_all.VirshListAll(context_wrap(NO_RESULT))
    assert output.fields == []
    assert output.cols == []
    assert output.keywords == []
    assert output.get_vm_state('NORHEL') is None
def test_virsh_output_error():
    assert_if_none(virsh_list_all.VirshListAll(context_wrap(ERROR)))
def test_virsh_output_blank():
    assert_if_none(virsh_list_all.VirshListAll(context_wrap(BLANK)))
def test_virsh_output_no_vms():
    assert_if_none(virsh_list_all.VirshListAll(context_wrap(NO_RESULT)))