def action_of_enum_value():
    print r"==action_of_enum_value=="
    client.send_data_to_server(r"ResetDataSource").get()
    product_user_access = r"Products(5)/UserAccess"
    user_access_value = odata_client_python.to_enum_value(client.get_data_from_server(product_user_access).get()[0])
    print user_access_value.to_string() == r"None"
    model = client.get_model().get()
    new_access = odata_client_python.odata_enum_value(model.find_enum_type(r"AccessLevel"), r"ReadWrite")
    parameters = odata_client_python.vector_odata_parameter()
    parameters.push_back(odata_client_python.odata_parameter(r"accessRight", new_access))
    returned_values = odata_client_python.vector_odata_value()
    client.send_data_to_server(r"Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight", parameters, returned_values).get()
    print len(returned_values) == 1
    returned_value = returned_values[0];
    user_access_value = odata_client_python.to_enum_value(client.get_data_from_server(product_user_access).get()[0])
    print user_access_value.to_string() == r"ReadWrite"
    returned_enum_value = odata_client_python.to_enum_value(returned_value)
    print returned_enum_value.to_string() == r"ReadWrite"
def update_enum_property():
    print r"==update_enum_property=="
    client.send_data_to_server(r"ResetDataSource").get()
    model = client.get_model().get()
    old_data = client.get_data_from_server(r"Products(5)").get()
    old_entity = odata_client_python.to_entity_value(old_data[0])
    old_value = odata_client_python.odata_value()
    old_entity.get_property_value(r"UserAccess", old_value)
    old_enum = odata_client_python.to_enum_value(old_value)
    print old_enum.to_string() == r"None"
    access_level_type = model.find_enum_type(r"AccessLevel")
    new_access = odata_client_python.odata_enum_value(access_level_type, r"ReadWrite")
    old_entity.set_value(r"UserAccess", new_access)
    response_code = client.patch_entity(r"Products", old_entity).get()
    print response_code == 204
    new_data = client.get_data_from_server(r"Products(5)").get()
    new_entity = odata_client_python.to_entity_value(new_data[0])
    new_value = odata_client_python.odata_value()
    new_entity.get_property_value(r"UserAccess", new_value)
    new_enum = odata_client_python.to_enum_value(new_value)
    print new_enum.to_string() == r"ReadWrite"
def update_enum_property():
    print r"==update_enum_property=="
    client.send_data_to_server(r"ResetDataSource").get()
    model = client.get_model().get()
    old_data = client.get_data_from_server(r"Products(5)").get()
    old_entity = odata_client_python.to_entity_value(old_data[0])
    old_value = odata_client_python.odata_value()
    old_entity.get_property_value(r"UserAccess", old_value)
    old_enum = odata_client_python.to_enum_value(old_value)
    print old_enum.to_string() == r"None"
    access_level_type = model.find_enum_type(r"AccessLevel")
    new_access = odata_client_python.odata_enum_value(access_level_type,
                                                      r"ReadWrite")
    old_entity.set_value(r"UserAccess", new_access)
    response_code = client.patch_entity(r"Products", old_entity).get()
    print response_code == 204
    new_data = client.get_data_from_server(r"Products(5)").get()
    new_entity = odata_client_python.to_entity_value(new_data[0])
    new_value = odata_client_python.odata_value()
    new_entity.get_property_value(r"UserAccess", new_value)
    new_enum = odata_client_python.to_enum_value(new_value)
    print new_enum.to_string() == r"ReadWrite"
def action_of_enum_value():
    print r"==action_of_enum_value=="
    client.send_data_to_server(r"ResetDataSource").get()
    product_user_access = r"Products(5)/UserAccess"
    user_access_value = odata_client_python.to_enum_value(
        client.get_data_from_server(product_user_access).get()[0])
    print user_access_value.to_string() == r"None"
    model = client.get_model().get()
    new_access = odata_client_python.odata_enum_value(
        model.find_enum_type(r"AccessLevel"), r"ReadWrite")
    parameters = odata_client_python.vector_odata_parameter()
    parameters.push_back(
        odata_client_python.odata_parameter(r"accessRight", new_access))
    returned_values = odata_client_python.vector_odata_value()
    client.send_data_to_server(
        r"Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight",
        parameters, returned_values).get()
    print len(returned_values) == 1
    returned_value = returned_values[0]
    user_access_value = odata_client_python.to_enum_value(
        client.get_data_from_server(product_user_access).get()[0])
    print user_access_value.to_string() == r"ReadWrite"
    returned_enum_value = odata_client_python.to_enum_value(returned_value)
    print returned_enum_value.to_string() == r"ReadWrite"