Example #1
0
def test_get_flow_file_not_found(fake_temp_repo, caplog):
    storage = Git(repo="test/repo", flow_path="flow.py", flow_name="my-flow")
    storage.add_flow(Flow("my-flow"))
    with pytest.raises(FileNotFoundError):
        flow = storage.get_flow("my-flow")

    fake_temp_repo.assert_called_with(
        branch_name=storage.branch_name,
        clone_depth=storage.clone_depth,
        git_clone_url=storage.git_clone_url,
        tag=storage.tag,
        commit=storage.commit,
    )
Example #2
0
def test_get_flow(fake_temp_repo, fake_extract_flow_from_file):
    storage = Git(repo="test/repo", flow_path="flow.py", flow_name="my-flow")
    storage.add_flow(Flow("my-flow"))
    flow = storage.get_flow("my-flow")
    fake_temp_repo.assert_called_with(
        branch_name=storage.branch_name,
        clone_depth=storage.clone_depth,
        git_clone_url=storage.git_clone_url,
        tag=storage.tag,
        commit=storage.commit,
    )
    fake_extract_flow_from_file.assert_called_with(
        file_path=f"/tmp/test/{storage.flow_path}", flow_name=storage.flow_name
    )