37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import pytest
|
|
|
|
from app.services.analyzer_common import DISCLAIMER
|
|
from app.services.bazi_analyzer import BaziAnalyzer
|
|
from app.services.bazi_calculator import BaziCalculator
|
|
from app.services.face_analyzer import FaceAnalyzer
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_face_mock_report_has_required_shape(monkeypatch):
|
|
monkeypatch.setattr("app.services.analyzer_common.settings.openai_api_key", None)
|
|
report = await FaceAnalyzer().analyze(b"fake", "image/jpeg")
|
|
|
|
assert report["quality_check"]["can_analyze"] is True
|
|
assert len(report["dimensions"]) >= 6
|
|
assert report["disclaimer"] == DISCLAIMER
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_bazi_mock_report_has_required_shape(monkeypatch):
|
|
monkeypatch.setattr("app.services.analyzer_common.settings.openai_api_key", None)
|
|
chart = BaziCalculator().calculate(
|
|
{
|
|
"calendar_type": "solar",
|
|
"birth_date": "1992-08-18",
|
|
"birth_time": "09:30",
|
|
"time_unknown": False,
|
|
"birth_place": "广东深圳",
|
|
}
|
|
)
|
|
report = await BaziAnalyzer().analyze(chart)
|
|
|
|
assert chart["pillars"]["year"]
|
|
assert report["quality_check"]["can_analyze"] is True
|
|
assert len(report["dimensions"]) >= 6
|
|
assert report["disclaimer"] == DISCLAIMER
|