Files
OpenJarvis/tests/server/test_api_routes.py
T
Jon Saad-FalconandClaude Opus 4.6 a4c4081ff4 Add desktop distribution pipeline: rolling releases, auto-updates, code signing
- Rewrite .github/workflows/desktop.yml: 2-job pipeline (validate + build-and-release)
  with rolling desktop-latest pre-release on push to main and stable desktop-v* releases
- Add UpdateChecker component: checks for updates on startup + every 30 min,
  background download with progress bar, one-click relaunch
- Configure Tauri updater: endpoints pointing to desktop-latest release, pubkey placeholder
- Add tauri-plugin-process for relaunch support (Cargo.toml, lib.rs, package.json)
- Add macOS Entitlements.plist for notarization (network + file access, no sandbox)
- Add scripts/bump-desktop-version.sh for atomic version bumps across 3 config files
- Add desktop/README.md with dev setup, auto-update architecture, signing docs
- Update .gitignore for desktop/node_modules, dist, target
- Configure macOS minimumSystemVersion, Windows timestampUrl
- Include all Phase 14-21 work: agent hardening, RBAC, taint tracking, workflows,
  skills, knowledge graph, sessions, A2A, MCP templates, WASM sandbox, TUI dashboard,
  production tools, CLI expansion, API expansion, learning productionization,
  Tauri desktop app, and 10 new channels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 19:14:05 +00:00

95 lines
2.8 KiB
Python

"""Tests for extended API routes."""
import pytest
fastapi = pytest.importorskip("fastapi")
from fastapi import FastAPI # noqa: E402
from fastapi.testclient import TestClient # noqa: E402
from openjarvis.server.api_routes import include_all_routes # noqa: E402
def _make_app():
app = FastAPI()
include_all_routes(app)
return app
class TestAgentRoutes:
def test_list_agents(self):
client = TestClient(_make_app())
resp = client.get("/v1/agents")
assert resp.status_code == 200
data = resp.json()
assert "registered" in data
assert "running" in data
def test_create_agent(self):
client = TestClient(_make_app())
resp = client.post("/v1/agents", json={"agent_type": "simple"})
# May succeed or fail depending on agent_tools availability
assert resp.status_code in (200, 501)
def test_kill_nonexistent(self):
client = TestClient(_make_app())
resp = client.delete("/v1/agents/nonexistent")
assert resp.status_code in (404, 501)
class TestMemoryRoutes:
def test_search(self):
client = TestClient(_make_app())
resp = client.post("/v1/memory/search", json={"query": "test"})
# May fail if SQLite not set up, that's ok
assert resp.status_code in (200, 500)
def test_stats(self):
client = TestClient(_make_app())
resp = client.get("/v1/memory/stats")
assert resp.status_code in (200, 500)
class TestBudgetRoutes:
def test_get_budget(self):
client = TestClient(_make_app())
resp = client.get("/v1/budget")
assert resp.status_code == 200
data = resp.json()
assert "limits" in data
assert "usage" in data
def test_set_limits(self):
client = TestClient(_make_app())
resp = client.put("/v1/budget/limits", json={"max_tokens_per_day": 100000})
assert resp.status_code == 200
assert resp.json()["limits"]["max_tokens_per_day"] == 100000
class TestMetricsRoute:
def test_metrics_endpoint(self):
client = TestClient(_make_app())
resp = client.get("/metrics")
assert resp.status_code == 200
assert "openjarvis" in resp.text or "No metrics" in resp.text
class TestSkillRoutes:
def test_list_skills(self):
client = TestClient(_make_app())
resp = client.get("/v1/skills")
assert resp.status_code == 200
assert "skills" in resp.json()
class TestSessionRoutes:
def test_list_sessions(self):
client = TestClient(_make_app())
resp = client.get("/v1/sessions")
assert resp.status_code == 200
class TestTraceRoutes:
def test_list_traces(self):
client = TestClient(_make_app())
resp = client.get("/v1/traces")
assert resp.status_code == 200