mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-07 12:47:55 -10:00
fix: tighten MCP transport tests and update stale http examples
- Assert exit_code == 2 for invalid/unsupported transports (usage-error contract) - Assert http-stream rejection points to 'praisonai mcp serve --transport http-stream' - Assert help advertises 'stdio, sse' - Update stale '--transport http' examples to the sibling http-stream command Co-authored-by: Mervin Praison <[email protected]>
This commit is contained in:
1 parent
60af031584
commit
dadb87a1aa
3 files changed
+6
-4
No files matched your search
@@ -24,7 +24,7 @@ Examples for all PraisonAI server types and the unified endpoints CLI.
|
||||
| `praisonai serve unified --port 8765` | Start unified server |
|
||||
| `praisonai serve agents --file agents.yaml --port 8000` | Start agents API |
|
||||
| `praisonai serve recipe --port 8765` | Start recipe server |
|
||||
| `praisonai serve mcp --transport http --port 8080` | Start MCP server |
|
||||
| `praisonai mcp serve --transport http-stream --port 8080` | Start MCP server |
|
||||
| `praisonai serve tools --port 8081` | Start tools MCP server |
|
||||
| `praisonai serve a2a --port 8082` | Start A2A server |
|
||||
| `praisonai serve a2u --port 8083` | Start A2U server |
|
||||
|
||||
@@ -13,7 +13,7 @@ Usage:
|
||||
python mcp_http_server.py
|
||||
|
||||
# Or use CLI:
|
||||
praisonai serve mcp --transport http --port 8080
|
||||
praisonai mcp serve --transport http-stream --port 8080
|
||||
|
||||
# Test with curl:
|
||||
curl http://localhost:8080/mcp/tools
|
||||
|
||||
@@ -63,7 +63,7 @@ def test_typo_does_not_open_a_listening_socket(transport_calls, typo):
|
||||
assert transport_calls == [], (
|
||||
f"--transport {typo!r} started the {transport_calls} transport"
|
||||
)
|
||||
assert result.exit_code != 0
|
||||
assert result.exit_code == 2
|
||||
# The error names the values the user could have meant.
|
||||
assert "stdio" in result.output and "sse" in result.output
|
||||
|
||||
@@ -72,8 +72,9 @@ def test_http_stream_is_rejected_not_aliased_to_sse(transport_calls):
|
||||
"""http-stream is advertised but unimplemented here; reject it loudly."""
|
||||
result = _invoke("http-stream")
|
||||
assert transport_calls == [], "http-stream silently ran the SSE transport"
|
||||
assert result.exit_code != 0
|
||||
assert result.exit_code == 2
|
||||
assert "http-stream" in result.output
|
||||
assert "praisonai mcp serve --transport http-stream" in result.output
|
||||
|
||||
|
||||
def test_help_does_not_advertise_an_unsupported_transport():
|
||||
@@ -84,3 +85,4 @@ def test_help_does_not_advertise_an_unsupported_transport():
|
||||
# Strip Rich's line wrapping before matching.
|
||||
flat = " ".join(result.output.split())
|
||||
assert "http-stream" not in flat
|
||||
assert "stdio, sse" in flat
|
||||
Reference in new issue
Block a user