mirror of
https://github.com/pocketpaw/pocketpaw.git
synced 2026-05-20 00:41:09 +00:00
- Auto-fix 155 errors (import sorting, annotations, deprecated imports) - Format 87 files with ruff format for line length compliance - Fix 15 F401 unused imports (add __all__ for re-exports, remove truly unused) - Fix 7 F841 unused variables (prefix with _) - Fix 2 F821 undefined names (add missing imports) - Fix 3 E402 module-level imports not at top - Fix 2 UP042 str+Enum → StrEnum - Fix 1 E712 == False comparison - Fix remaining 51 E501 line-too-long in string literals and expressions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
98 lines
2.3 KiB
Python
98 lines
2.3 KiB
Python
"""Integration smoke test — verify all cloud routes mount correctly."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from ee.cloud import mount_cloud
|
|
|
|
|
|
def _get_route_paths(app: FastAPI) -> list[str]:
|
|
"""Extract all route paths from a FastAPI app."""
|
|
paths = []
|
|
for route in app.routes:
|
|
if hasattr(route, "path"):
|
|
paths.append(route.path)
|
|
return paths
|
|
|
|
|
|
def test_mount_cloud_succeeds():
|
|
"""mount_cloud() should not raise."""
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
|
|
|
|
def test_auth_routes_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
# fastapi-users mounts at /api/v1/auth/*
|
|
assert any("/auth" in p for p in paths)
|
|
|
|
|
|
def test_workspace_routes_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert any("/workspaces" in p for p in paths)
|
|
|
|
|
|
def test_agents_routes_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert any("/agents" in p for p in paths)
|
|
|
|
|
|
def test_chat_routes_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert any("/chat" in p for p in paths)
|
|
|
|
|
|
def test_pockets_routes_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert any("/pockets" in p for p in paths)
|
|
|
|
|
|
def test_sessions_routes_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert any("/sessions" in p for p in paths)
|
|
|
|
|
|
def test_websocket_endpoint_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert any("ws/cloud" in p for p in paths)
|
|
|
|
|
|
def test_license_endpoint_mounted():
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
assert "/api/v1/license" in paths
|
|
|
|
|
|
def test_cloud_error_handler_registered():
|
|
"""CloudError exception handler should be registered."""
|
|
from ee.cloud.shared.errors import CloudError
|
|
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
assert CloudError in app.exception_handlers
|
|
|
|
|
|
def test_total_route_count():
|
|
"""Sanity check — we should have a good number of routes."""
|
|
app = FastAPI()
|
|
mount_cloud(app)
|
|
paths = _get_route_paths(app)
|
|
# We have ~50+ endpoints across 6 domains + license + ws
|
|
assert len(paths) >= 40, f"Only {len(paths)} routes mounted — expected 40+"
|