예제 #1
0
def test_add_flow_to_git_already_added():
    storage = Git(repo="test/repo", flow_path="flow.py")

    f = Flow("test")
    assert f.name not in storage
    assert storage.add_flow(f) == "flow.py"
    assert f.name in storage

    with pytest.raises(ValueError):
        storage.add_flow(f)
예제 #2
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,
    )
예제 #3
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
    )
예제 #4
0
def test_add_flow_to_git_storage():
    storage = Git(repo="test/repo", flow_path="flow.py")

    f = Flow("test")
    assert f.name not in storage
    assert storage.add_flow(f) == "flow.py"
    assert f.name in storage