Exemplo n.º 1
0
def test_flow_view_handles_extra_and_missing_fields_in_serialized_flows():
    flow_data = FLOW_DATA_1.copy()
    serialized = flow_data["serialized_flow"]
    serialized["extra_field"] = "foo"  # extra data
    serialized.pop("parameters")  # missing data
    flow_view = FlowView._from_flow_data(flow_data)
    assert isinstance(flow_view.flow, Flow)
Exemplo n.º 2
0
def test_flow_view_from_returns_instance(patch_post, from_method):
    patch_post({"data": {"flow": [FLOW_DATA_1]}})

    if from_method == "flow_id":
        flow = FlowView.from_flow_id("id-1")
    elif from_method == "flow_data":
        # Note the post patch will not be used since there is no query here
        flow = FlowView._from_flow_data(FLOW_DATA_1)

    assert flow.flow_id == "id-1"
    assert flow.serialized_flow == FLOW_DATA_1["serialized_flow"]
    assert flow.flow == Flow("flow-1")
    assert flow.name == "name-1"
    assert flow.settings == {"key-1": "value-1"}
    assert flow.flow_group_labels == ["label-1"]
    assert isinstance(flow.run_config, UniversalRun)
    assert flow.run_config.env == {"ENV-1": "VAL-1"}
    assert flow.archived is False
    assert flow.project_name == "project-1"
    assert flow.core_version == "0.0.0"
    assert isinstance(flow.storage, Local)
    assert flow.storage.stored_as_script is True
    assert flow.storage.path == "fake-path-1.py"
Exemplo n.º 3
0
def test_flow_view_handles_null_run_config():
    flow_data = FLOW_DATA_1.copy()
    flow_data["run_config"] = None
    flow_view = FlowView._from_flow_data(flow_data)
    assert flow_view.run_config is None