예제 #1
0
def test_get_runner_returns_flow_or_flow_runner():
    s = Bytes()
    f = Flow("test")
    s.add_flow(f)
    runner = s.get_runner("test")
    assert runner == f

    with set_temporary_config({"engine.flow_runner.default_class":
                               FlowRunner}):
        runner = s.get_runner("test", return_flow=False)
        assert isinstance(runner, FlowRunner)
        assert runner.flow == f
예제 #2
0
def test_multiple_flows_in_storage():
    s = Bytes()
    f = Flow("test")
    g = Flow("other")
    z = Flow("not")
    s.add_flow(f)
    s.add_flow(g)

    assert "test" in s
    assert "other" in s
    assert "not" not in s

    assert s.get_runner("test") == f
    assert s.get_runner("other") == g

    assert isinstance(s.flows["test"], bytes)
    assert isinstance(s.flows["other"], bytes)
예제 #3
0
def test_get_runner_raises_if_flow_not_present():
    s = Bytes()
    with pytest.raises(ValueError):
        s.get_runner("test")