예제 #1
0
def validate_details_data(data):
    """
    Validates details of the file before saving
    """
    if data["default_onError"]["@action"] in on_errors():
        data["default_onError"]["@action"] = on_errors()[
            data["default_onError"]["@action"]]
    return data
예제 #2
0
def validate_step_data(data):
    """
    Validates steps of the file before saving
    """
    for ts in range(0, len(data)):
        if data[ts]["impact"] in impacts():
            data[ts]["impact"] = impacts()[data[ts]["impact"]]
        if data[ts]["context"] in contexts():
            data[ts]["context"] = contexts()[data[ts]["context"]]
        for i in range(0, len(data[ts]["Execute"]["Rule"])):
            if data[ts]["Execute"]["Rule"][i]["@Else"] in on_errors():
                data[ts]["Execute"]["Rule"][i]["@Else"] = on_errors()[
                    data[ts]["Execute"]["Rule"][i]["@Else"]]
        if data[ts]["runmode"]["@type"] in runmodes():
            data[ts]["runmode"]["@type"] = runmodes()[data[ts]["runmode"]
                                                      ["@type"]]
        if data[ts]["Iteration_type"]["@type"] in iteration_types():
            data[ts]["Iteration_type"]["@type"] = iteration_types()[
                data[ts]["Iteration_type"]["@type"]]
        if data[ts]["onError"]["@action"] in on_errors():
            data[ts]["onError"]["@action"] = on_errors()[data[ts]["onError"]
                                                         ["@action"]]
    return data