refactor: reorganize into monorepo with separate subprojects
Structure webber into three independent subprojects: - webber-api/: FastAPI backend server with all agent code - webber-cli/: Standalone CLI client (renamed from cli/ to webber_cli/) - webber-sandbox/: Test project for functional testing Key changes: - Each subproject has its own .venv (Python 3.12+) - Added sandbox.sh for managing test project templates - Created sandbox-templates/ with calculator-cli and empty starter - Updated CI/CD for prefixed tags (api/v*, cli/v*) - Added comprehensive AGENTS.md with operational instructions - Added gitignore filtering to glob and grep tools - Created pyproject.toml for each subproject Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
"""
|
||||
Tests for agent REST API endpoints.
|
||||
"""
|
||||
import pytest
|
||||
|
||||
|
||||
class TestAgentListEndpoint:
|
||||
"""Tests for GET /agents/ endpoint."""
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_agents(self, auth_client):
|
||||
"""Test listing available agents."""
|
||||
response = await auth_client.get("/agents/")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "agents" in data
|
||||
assert len(data["agents"]) >= 1
|
||||
|
||||
# Check explore agent is present
|
||||
agent_names = [a["name"] for a in data["agents"]]
|
||||
assert "explore" in agent_names
|
||||
|
||||
|
||||
class TestAgentInfoEndpoint:
|
||||
"""Tests for GET /agents/{agent_type} endpoint."""
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_explore_agent_info(self, auth_client):
|
||||
"""Test getting explore agent info."""
|
||||
response = await auth_client.get("/agents/explore")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == "explore"
|
||||
assert "description" in data
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_unknown_agent(self, auth_client):
|
||||
"""Test getting info for unknown agent."""
|
||||
response = await auth_client.get("/agents/nonexistent")
|
||||
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
class TestAgentRunEndpoint:
|
||||
"""Tests for POST /agents/run endpoint."""
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_run_with_unknown_agent(self, auth_client):
|
||||
"""Test running unknown agent type."""
|
||||
response = await auth_client.post(
|
||||
"/agents/run",
|
||||
json={
|
||||
"prompt": "test",
|
||||
"agent_type": "nonexistent",
|
||||
"working_dir": "."
|
||||
}
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert "Unknown agent" in response.json()["detail"]
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_run_request_validation(self, auth_client):
|
||||
"""Test request validation."""
|
||||
# Missing required field
|
||||
response = await auth_client.post(
|
||||
"/agents/run",
|
||||
json={
|
||||
"working_dir": "."
|
||||
}
|
||||
)
|
||||
|
||||
assert response.status_code == 422 # Validation error
|
||||
Reference in New Issue
Block a user