示例#1
0
def test_rest_conversion_host_crud(appliance, source_provider, provider,
                                   transformation_method):
    """
    Tests conversion host crud via REST
    Polarion:
        assignee: sshveta
        casecomponent: V2V
        testtype: functional
        initialEstimate: 1/2h
        startsin: 5.9
        tags: V2V
    """
    # Test1: Create two conversion host
    set_conversion_host_api(appliance, transformation_method, source_provider,
                            provider)
    conversion_collection = appliance.rest_api.collections.conversion_hosts
    conv_host = conversion_collection.all

    # Test2: Edit first conversion host
    fixed_limit = 100
    edited_conv_host = conversion_collection.action.edit(
        id=conv_host[0].id, max_concurrent_tasks=fixed_limit)[0]
    assert edited_conv_host.max_concurrent_tasks == fixed_limit

    # Test3: Delete both conversion host
    for c in conv_host:
        response = conversion_collection.action.delete(id=c.id)[0]
        wait_for(
            lambda: response.state == "Finished",
            fail_func=response.reload,
            num_sec=240,
            delay=3,
            message=
            "Waiting for conversion host configuration task to be deleted")
    assert not conversion_collection.all
 def _cleanup():
     migration_plan.delete_completed_plan()
     set_conversion_host_api(appliance, "vddk", source_provider, provider)