Explorar el Código

test(garden): add MCP tests for cycle list and latest-cycle defaults

Lukas Goldschmidt hace 1 mes
padre
commit
71da051c6f
Se han modificado 1 ficheros con 25 adiciones y 0 borrados
  1. 25 0
      test_garden_layer.py

+ 25 - 0
test_garden_layer.py

@@ -136,6 +136,31 @@ def test_mcp_garden_cycle_plants():
         assert plant_uri, "Each binding should include a plant URI"
 
 
+def test_mcp_garden_cycle_plants_latest_when_cycle_uri_missing():
+    """MCP compliance: cycle_uri should be optional and default to latest cycle."""
+    result = call_mcp_tool(
+        "garden_cycle_plants",
+        {"limit": 3},
+    )
+    bindings = result.get("results", {}).get("bindings", [])
+    assert bindings, "Expected plant bindings from the latest cycle when cycle_uri is omitted"
+
+
+def test_mcp_garden_cycle_list_detailed_has_strain_info():
+    """Ensure the detailed cycle list includes strain labels/descriptions and clone siblings."""
+    result = call_mcp_tool(
+        "garden_cycle_list_detailed",
+        {"limit": 10},
+    )
+    bindings = result.get("results", {}).get("bindings", [])
+    assert bindings, "Expected at least one binding from garden_cycle_list_detailed"
+
+    # Check that at least one binding has strainDesc or cloneSiblings populated.
+    any_strain_desc = any('strainDesc' in b and b.get('strainDesc', {}).get('value') for b in bindings)
+    any_siblings = any('cloneSiblings' in b and b.get('cloneSiblings', {}).get('value') for b in bindings)
+    assert any_strain_desc or any_siblings, "Expected strainDesc and/or cloneSiblings to be present"
+
+
 def test_load_examples_fixture(garden_layer):
     if os.getenv("MCP_ALLOW_EXAMPLE_LOAD", "false").lower() != "true":
         pytest.skip("MCP_ALLOW_EXAMPLE_LOAD must be true to load example fixtures")