type: narrow API test result payloads
This commit is contained in:
@@ -207,6 +207,7 @@ async def test_create_artifact_from_workspace_suggests_exact_available_source_bi
|
|||||||
outcomes=("completed",),
|
outcomes=("completed",),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert result["saved"] is True
|
||||||
assert result["required_logical_sources"] == ["demo.personal"]
|
assert result["required_logical_sources"] == ["demo.personal"]
|
||||||
assert result["suggested_bindings"] == {"demo.personal": "demo.personal"}
|
assert result["suggested_bindings"] == {"demo.personal": "demo.personal"}
|
||||||
|
|
||||||
|
|||||||
@@ -153,10 +153,12 @@ def test_run_api_rejects_resume_for_completed_run(tmp_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
run_id = result["run_id"]
|
||||||
|
assert isinstance(run_id, str)
|
||||||
with pytest.raises(ValueError, match="is not interrupted"):
|
with pytest.raises(ValueError, match="is not interrupted"):
|
||||||
asyncio.run(
|
asyncio.run(
|
||||||
api.resume_run(
|
api.resume_run(
|
||||||
run_id=result["run_id"],
|
run_id=run_id,
|
||||||
resume_payload={"answer": "ignored"},
|
resume_payload={"answer": "ignored"},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -178,13 +180,17 @@ def test_run_api_inspect_uses_pinned_environment_after_deployment_deleted(
|
|||||||
)
|
)
|
||||||
artifact_store.delete_deployment("echo.personal")
|
artifact_store.delete_deployment("echo.personal")
|
||||||
|
|
||||||
summary = asyncio.run(api.inspect_run(run_id=result["run_id"]))
|
run_id = result["run_id"]
|
||||||
|
assert isinstance(run_id, str)
|
||||||
|
summary = asyncio.run(api.inspect_run(run_id=run_id))
|
||||||
|
|
||||||
assert summary["status"] == "completed"
|
assert summary["status"] == "completed"
|
||||||
assert summary["run_id"] == result["run_id"]
|
assert summary["run_id"] == run_id
|
||||||
assert summary["deployment_id"] == "echo.personal"
|
assert summary["deployment_id"] == "echo.personal"
|
||||||
assert summary["artifact_id"] == "echo"
|
assert summary["artifact_id"] == "echo"
|
||||||
assert summary["output"]["echoed"] == "hello"
|
output = summary["output"]
|
||||||
|
assert output is not None
|
||||||
|
assert output["echoed"] == "hello"
|
||||||
|
|
||||||
|
|
||||||
def test_run_api_inspect_and_bounded_trace(tmp_path: Path) -> None:
|
def test_run_api_inspect_and_bounded_trace(tmp_path: Path) -> None:
|
||||||
@@ -200,6 +206,7 @@ def test_run_api_inspect_and_bounded_trace(tmp_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
run_id = result["run_id"]
|
run_id = result["run_id"]
|
||||||
|
assert isinstance(run_id, str)
|
||||||
|
|
||||||
summary = asyncio.run(api.inspect_run(run_id=run_id))
|
summary = asyncio.run(api.inspect_run(run_id=run_id))
|
||||||
trace = asyncio.run(
|
trace = asyncio.run(
|
||||||
@@ -261,6 +268,7 @@ def test_run_api_handler_delegation_matches(tmp_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
run_id = run_result["run_id"]
|
run_id = run_result["run_id"]
|
||||||
|
assert isinstance(run_id, str)
|
||||||
|
|
||||||
handler_summary = asyncio.run(handlers.inspect_run(run_id=run_id))
|
handler_summary = asyncio.run(handlers.inspect_run(run_id=run_id))
|
||||||
api_summary = asyncio.run(api.inspect_run(run_id=run_id))
|
api_summary = asyncio.run(api.inspect_run(run_id=run_id))
|
||||||
@@ -477,4 +485,6 @@ async def test_resume_run_rejects_payload_that_violates_interrupt_schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert resumed["status"] == "failed"
|
assert resumed["status"] == "failed"
|
||||||
assert "interrupt resume for approval" in resumed["error"]
|
error = resumed["error"]
|
||||||
|
assert isinstance(error, str)
|
||||||
|
assert "interrupt resume for approval" in error
|
||||||
|
|||||||
@@ -198,7 +198,9 @@ def test_inspect_source_includes_optional_diagnostics() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert payload["id"] == "demo.personal"
|
assert payload["id"] == "demo.personal"
|
||||||
assert payload["diagnostics"]["source_id"] == "demo.personal"
|
diagnostics = payload.get("diagnostics")
|
||||||
|
assert diagnostics is not None
|
||||||
|
assert diagnostics.get("source_id") == "demo.personal"
|
||||||
assert provider.calls == ["demo.personal"]
|
assert provider.calls == ["demo.personal"]
|
||||||
|
|
||||||
|
|
||||||
@@ -227,8 +229,12 @@ def test_inspect_source_tolerates_diagnostics_provider_failure() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert payload["id"] == "demo.personal"
|
assert payload["id"] == "demo.personal"
|
||||||
assert payload["diagnostics"]["status"] == "error"
|
diagnostics = payload.get("diagnostics")
|
||||||
assert "Diagnostics unavailable" in payload["diagnostics"]["message"]
|
assert diagnostics is not None
|
||||||
|
assert diagnostics["status"] == "error"
|
||||||
|
message = diagnostics.get("message")
|
||||||
|
assert message is not None
|
||||||
|
assert "Diagnostics unavailable" in message
|
||||||
|
|
||||||
|
|
||||||
def test_diagnose_source_uses_provider() -> None:
|
def test_diagnose_source_uses_provider() -> None:
|
||||||
@@ -240,7 +246,9 @@ def test_diagnose_source_uses_provider() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert payload["status"] == "ok"
|
assert payload["status"] == "ok"
|
||||||
assert payload["auth"]["record_present"] is True
|
auth = payload.get("auth")
|
||||||
|
assert auth is not None
|
||||||
|
assert auth.get("record_present") is True
|
||||||
|
|
||||||
|
|
||||||
class _ExtendedDiagnostics:
|
class _ExtendedDiagnostics:
|
||||||
|
|||||||
@@ -150,7 +150,9 @@ def test_inspect_returns_full_entry_and_shadow_flag() -> None:
|
|||||||
payload = asyncio.run(api.inspect_registry_entry(source_id="github.work"))
|
payload = asyncio.run(api.inspect_registry_entry(source_id="github.work"))
|
||||||
|
|
||||||
assert payload["entry"]["id"] == "github.work"
|
assert payload["entry"]["id"] == "github.work"
|
||||||
assert payload["entry"]["transport"]["kind"] == "stdio"
|
transport = payload["entry"].get("transport")
|
||||||
|
assert transport is not None
|
||||||
|
assert transport["kind"] == "stdio"
|
||||||
assert payload["shadowed_by_config"] is True
|
assert payload["shadowed_by_config"] is True
|
||||||
|
|
||||||
|
|
||||||
@@ -236,7 +238,7 @@ def test_add_registry_entry() -> None:
|
|||||||
payload = asyncio.run(api.add_registry_entry(entry=new_entry))
|
payload = asyncio.run(api.add_registry_entry(entry=new_entry))
|
||||||
|
|
||||||
assert payload["entry"]["id"] == "new.source"
|
assert payload["entry"]["id"] == "new.source"
|
||||||
assert payload["entry"]["provider"] == "new"
|
assert payload["entry"].get("provider") == "new"
|
||||||
assert payload["shadowed_by_config"] is False
|
assert payload["shadowed_by_config"] is False
|
||||||
|
|
||||||
|
|
||||||
@@ -267,7 +269,7 @@ def test_update_registry_entry() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert payload["entry"]["id"] == "upd.source"
|
assert payload["entry"]["id"] == "upd.source"
|
||||||
assert payload["entry"]["provider"] == "new"
|
assert payload["entry"].get("provider") == "new"
|
||||||
assert payload["shadowed_by_config"] is False
|
assert payload["shadowed_by_config"] is False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user