def test_trigger_node_in_subgraph(tmp_path: Path): dr = set_tmp_dir(tmp_path).parent / "graph" name = "sub/graph.yml" run_cli("create graph", f"{dr}\n") path = dr / name run_cli(f"create node", f"{path}\n") name = (dr / "sub/p.py").as_posix() run_cli(f"create node", f"{name}\n") with request_mocker() as m: m.post( API_BASE_URL + Endpoints.DEPLOYMENTS_TRIGGER_NODE, json={"uid": "1"}, ) m.get( API_BASE_URL + Endpoints.graph_by_slug("test-org-uid", "graph"), json={"uid": "2"}, ) m.get( API_BASE_URL + Endpoints.graphs_latest("2"), json={"active_graph_version": { "uid": "3" }}, ) result = run_cli(f"trigger {name}") assert "Triggered node" in result.output
def test_deploy(tmp_path: Path): dr = set_tmp_dir(tmp_path).parent path = dr / "name" with request_mocker() as m: for e in [ Endpoints.graph_version_create("test-org-uid"), Endpoints.DEPLOYMENTS_DEPLOY, ]: m.post( API_BASE_URL + e, json={ "uid": "1", "ui_url": "url.com", "graph": { "name": "g" }, "manifest": {} }, ) for e in [ Endpoints.graph_by_slug("test-org-uid", "name"), Endpoints.graphs_latest("1"), ]: m.get( API_BASE_URL + e, json={ "uid": "1", "active_graph_version": { "uid": "1" } }, ) run_cli(f"create graph {path}") result = run_cli(f"upload --no-deploy {path}") assert "Uploaded new graph" in result.output assert "Graph deployed" not in result.output result = run_cli(f"deploy --graph={path}") assert "deployed" in result.output
def get_graph_by_uid(graph_uid: str) -> dict: return get_json(Endpoints.graphs_latest(graph_uid))