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)
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, )
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 )
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