You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
867 B
Python
29 lines
867 B
Python
# backend/tests/test_mail_ai.py
|
|
from app.llm.heuristic import HeuristicProvider
|
|
from app.models import Email
|
|
from app.services.mail_ai import analyze_email
|
|
|
|
|
|
def test_seed_email_uses_stored_ai(client, session):
|
|
s, _ = session
|
|
e = s.get(Email, "m1")
|
|
out = analyze_email(s, e, HeuristicProvider())
|
|
assert out["summary"].startswith("온보딩 시안 v3") # 시드 ai_json 재사용(결정성)
|
|
|
|
|
|
def test_new_email_heuristic_fallback(client, session):
|
|
s, _ = session
|
|
e = Email(
|
|
id="mX",
|
|
account="work",
|
|
from_key="hyunwoo",
|
|
subject="[중요] 14시 미팅 부탁",
|
|
body=["14시에 봬요"],
|
|
ai_json={},
|
|
)
|
|
s.add(e)
|
|
s.commit()
|
|
out = analyze_email(s, e, HeuristicProvider())
|
|
assert out["priority"] == "높음" # [중요]
|
|
assert len(out["events"]) == 1 # 14시 → event 후보
|