Initial commit: Pixel AI comic/video creation platform
- FastAPI backend with SQLModel, Alembic migrations, AgentScope agents - Next.js 15 frontend with React 19, Tailwind, Zustand, React Flow - Multi-provider AI system (DashScope, Kling, MiniMax, Volcengine, OpenAI, etc.) - All HTTP clients migrated from sync requests to async httpx - Admin-managed API keys via environment variables - SSRF vulnerability fixed in ensure_url()
This commit is contained in:
62
backend/tests/test_smoke.py
Normal file
62
backend/tests/test_smoke.py
Normal file
@@ -0,0 +1,62 @@
|
||||
"""
|
||||
冒烟测试:健康检查、API 前缀、projects 路由是否正常。
|
||||
使用正确前缀 /api/v1/ 校验本次重构涉及的路由。
|
||||
"""
|
||||
import pytest
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
from src.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
API = "/api/v1"
|
||||
|
||||
|
||||
def unwrap_response_data(response):
|
||||
payload = response.json()
|
||||
return payload.get("data", payload)
|
||||
|
||||
|
||||
class TestSmokeHealth:
|
||||
"""健康与存活"""
|
||||
|
||||
def test_health(self):
|
||||
r = client.get("/health")
|
||||
assert r.status_code == 200
|
||||
assert unwrap_response_data(r).get("status") == "healthy"
|
||||
|
||||
def test_health_live(self):
|
||||
r = client.get("/health/live")
|
||||
assert r.status_code == 200
|
||||
assert unwrap_response_data(r).get("status") == "alive"
|
||||
|
||||
|
||||
class TestSmokeProjects:
|
||||
"""Projects 控制器(重构后)"""
|
||||
|
||||
def test_list_projects(self):
|
||||
r = client.get(f"{API}/projects")
|
||||
assert r.status_code == 200
|
||||
data = r.json()
|
||||
assert "data" in data or "items" in str(data)
|
||||
|
||||
def test_get_nonexistent_project_404(self):
|
||||
r = client.get(f"{API}/projects/non-existent-id-12345")
|
||||
assert r.status_code == 404
|
||||
|
||||
|
||||
class TestSmokeConfig:
|
||||
"""Config 使用 /api/v1 前缀"""
|
||||
|
||||
def test_get_system_config(self):
|
||||
r = client.get(f"{API}/config/system")
|
||||
assert r.status_code == 200
|
||||
|
||||
def test_get_models_config(self):
|
||||
r = client.get(f"{API}/config/models")
|
||||
assert r.status_code == 200
|
||||
data = r.json()
|
||||
assert "data" in data or "models" in str(data)
|
||||
Reference in New Issue
Block a user