test_tongue.py 435 B

123456789101112
  1. import pytest
  2. from httpx import AsyncClient, ASGITransport
  3. from app.main import app
  4. @pytest.mark.asyncio
  5. async def test_tongue_diagnose_missing_file():
  6. """无文件上传应返回 422"""
  7. transport = ASGITransport(app=app)
  8. async with AsyncClient(transport=transport, base_url="http://test") as client:
  9. resp = await client.post("/api/v1/tongue/diagnose", data={"user_id": 1})
  10. assert resp.status_code == 422