Files
smart-support/backend/tests/unit/test_main.py
Yaojia Wang a54eb224e0 feat: complete phase 3 -- OpenAPI auto-discovery, SSRF protection, tool generation
- SSRF protection: private IP blocking, DNS rebinding defense, redirect validation
- OpenAPI fetcher with SSRF guard, JSON/YAML auto-detection, 10MB limit
- Structural spec validator (3.0.x/3.1.x)
- Endpoint parser with $ref resolution, auto-generated operation IDs
- Heuristic + LLM endpoint classifier with Protocol interface
- Review API at /api/openapi (import, job status, classification CRUD, approve)
- @tool code generator + Agent YAML generator
- Import orchestrator (fetch -> validate -> parse -> classify pipeline)
- 125 new tests, 322 total passing, 93.23% coverage
2026-03-31 00:10:44 +02:00

28 lines
738 B
Python

"""Tests for app.main module."""
from __future__ import annotations
import pytest
from app.main import AGENTS_YAML, FRONTEND_DIST, app
@pytest.mark.unit
class TestMainModule:
def test_app_title(self) -> None:
assert app.title == "Smart Support"
def test_app_version(self) -> None:
assert app.version == "0.3.0"
def test_agents_yaml_path_exists(self) -> None:
assert AGENTS_YAML.name == "agents.yaml"
def test_frontend_dist_path(self) -> None:
assert "frontend" in str(FRONTEND_DIST)
assert "dist" in str(FRONTEND_DIST)
def test_websocket_route_registered(self) -> None:
routes = [r.path for r in app.routes if hasattr(r, "path")]
assert "/ws" in routes