Initial commit: 包装审核 POC、Docker 与前后端

Made-with: Cursor
This commit is contained in:
2026-04-15 17:18:49 +08:00
commit bbb4dd43b3
74 changed files with 297415 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
from pathlib import Path
from fastapi.testclient import TestClient
from backend.app.main import app
WORKDIR = Path("/Users/icemilk/Workspace/zld_POC")
AI_FILE = WORKDIR / "【2026-04-09】端午 - 背标 - 天问.ai"
client = TestClient(app)
def test_ai_render_crop_endpoint_returns_two_images_and_crop_box() -> None:
with AI_FILE.open("rb") as ai_fp:
response = client.post(
"/api/ai-render-crop",
files={
"ai_file": (AI_FILE.name, ai_fp, "application/postscript"),
},
)
assert response.status_code == 200
payload = response.json()
assert payload["fullImage"]["type"] == "image"
assert payload["croppedImage"]["type"] == "image"
assert payload["fullImage"]["url"].endswith(".png")
assert payload["croppedImage"]["url"].endswith(".png")
assert payload["cropBox"]["x1"] > payload["cropBox"]["x0"]
assert payload["cropBox"]["y1"] > payload["cropBox"]["y0"]