feat: expose workflow execution modes in editor
This commit is contained in:
@@ -13,6 +13,7 @@ def test_build_preset_workflow_config_creates_canonical_dag():
|
||||
|
||||
assert config["version"] == 1
|
||||
assert config["ui"]["preset"] == "still"
|
||||
assert config["ui"]["execution_mode"] == "legacy"
|
||||
assert [node["step"] for node in config["nodes"]] == [
|
||||
"order_line_setup",
|
||||
"resolve_template",
|
||||
@@ -34,6 +35,7 @@ def test_canonicalize_workflow_config_migrates_legacy_preset():
|
||||
|
||||
assert canonical["version"] == 1
|
||||
assert canonical["ui"]["preset"] == "turntable"
|
||||
assert canonical["ui"]["execution_mode"] == "legacy"
|
||||
assert any(node["step"] == "blender_turntable" for node in canonical["nodes"])
|
||||
|
||||
|
||||
@@ -76,6 +78,7 @@ def test_canonicalize_legacy_custom_config_preserves_edges():
|
||||
canonical = canonicalize_workflow_config(legacy)
|
||||
|
||||
assert canonical["ui"]["preset"] == "custom"
|
||||
assert canonical["ui"]["execution_mode"] == "legacy"
|
||||
assert canonical["edges"] == [{"id": "e1", "from": "input", "to": "render"}]
|
||||
|
||||
|
||||
@@ -91,3 +94,19 @@ def test_extract_runtime_workflow_converts_resolution_to_dimensions():
|
||||
assert params["width"] == 1920
|
||||
assert params["height"] == 1080
|
||||
assert "resolution" not in params
|
||||
|
||||
|
||||
def test_canonicalize_workflow_config_defaults_execution_mode_for_canonical_configs():
|
||||
canonical = canonicalize_workflow_config(
|
||||
{
|
||||
"version": 1,
|
||||
"nodes": [
|
||||
{"id": "setup", "step": "order_line_setup", "params": {}},
|
||||
],
|
||||
"edges": [],
|
||||
"ui": {"preset": "custom"},
|
||||
}
|
||||
)
|
||||
|
||||
assert canonical["ui"]["preset"] == "custom"
|
||||
assert canonical["ui"]["execution_mode"] == "legacy"
|
||||
|
||||
@@ -45,3 +45,40 @@ async def test_node_definitions_endpoint_returns_registry(client, auth_headers):
|
||||
)
|
||||
assert blender_still["node_type"] == "renderNode"
|
||||
assert blender_still["defaults"]["render_engine"] == "cycles"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_workflow_crud_roundtrip_preserves_execution_mode(client, auth_headers):
|
||||
create_response = await client.post(
|
||||
"/api/workflows",
|
||||
headers=auth_headers,
|
||||
json={
|
||||
"name": "Shadow Workflow",
|
||||
"config": {
|
||||
"version": 1,
|
||||
"ui": {
|
||||
"preset": "custom",
|
||||
"execution_mode": "shadow",
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "setup",
|
||||
"step": StepName.ORDER_LINE_SETUP.value,
|
||||
"params": {},
|
||||
}
|
||||
],
|
||||
"edges": [],
|
||||
},
|
||||
"is_active": True,
|
||||
},
|
||||
)
|
||||
|
||||
assert create_response.status_code == 201
|
||||
created = create_response.json()
|
||||
assert created["config"]["ui"]["execution_mode"] == "shadow"
|
||||
|
||||
get_response = await client.get(f"/api/workflows/{created['id']}", headers=auth_headers)
|
||||
|
||||
assert get_response.status_code == 200
|
||||
fetched = get_response.json()
|
||||
assert fetched["config"]["ui"]["execution_mode"] == "shadow"
|
||||
|
||||
Reference in New Issue
Block a user