Add architecture package and application skeleton
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from ai_orchestrator.main import app
|
||||
|
||||
|
||||
def test_health_endpoint_returns_ok() -> None:
|
||||
client = TestClient(app)
|
||||
|
||||
response = client.get("/health")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"status": "ok"}
|
||||
|
||||
|
||||
def test_post_tasks_creates_planned_task() -> None:
|
||||
client = TestClient(app)
|
||||
|
||||
response = client.post(
|
||||
"/tasks",
|
||||
json={
|
||||
"project_id": "default",
|
||||
"goal": "Prepare a plan",
|
||||
"inputs": {"source": "test"},
|
||||
"execution_mode": "agent_graph",
|
||||
},
|
||||
)
|
||||
|
||||
payload = response.json()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert payload["status"] == "planned"
|
||||
assert payload["progress"]["total"] == 2
|
||||
|
||||
|
||||
def test_worker_registration_is_exposed_via_list_endpoint() -> None:
|
||||
client = TestClient(app)
|
||||
|
||||
registration = client.post(
|
||||
"/workers/register",
|
||||
json={
|
||||
"worker_id": "worker_home_pc",
|
||||
"name": "Home PC",
|
||||
"capabilities": ["file.read", "command.run"],
|
||||
"version": "0.1.0",
|
||||
"machine": "DESKTOP-1",
|
||||
"os": "windows",
|
||||
},
|
||||
)
|
||||
listing = client.get("/workers")
|
||||
|
||||
assert registration.status_code == 200
|
||||
assert listing.status_code == 200
|
||||
assert any(worker["worker_id"] == "worker_home_pc" for worker in listing.json()["workers"])
|
||||
Reference in New Issue
Block a user