Files
resume-agent/backend/tests/test_builder_revise_action.py
T
hypandClaude ae2d9b128d feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本:
- Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强)
- 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护
- 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏
- PostgreSQL 运行时 + Alembic 迁移链

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 11:08:30 +08:00

45 lines
1.9 KiB
Python

"""Revise action on the confirm card: fold uncovered facts back into the proposal (问题2c)."""
from __future__ import annotations
from typing import Any
from builder_flow_helpers import create_builder_session, event, finish_education, start_education
from test_api import active_component
def _revise(client: Any, session_id: str, body: dict[str, Any], payload: dict[str, Any]) -> Any:
return event(client, session_id, body, "revise", payload)
def test_revise_regenerates_proposal_with_instruction(client: Any) -> None:
session_id, body = create_builder_session(client)
card = start_education(client, session_id, body)
proposal = finish_education(client, session_id, card, "完成数据库课程项目。GPA: 4.3/5.0。")
response = _revise(
client, session_id, proposal,
{"instruction": "请将以下未覆盖的事实补进优化稿:GPA: 4.3/5.0,其他内容保持不变。"},
)
assert response.status_code == 200, response.text
reply = response.json()
assert active_component(reply)["data"]["component"] == "experience_confirm_card"
assert "重新" in reply["turn"]["content"]
proposal_data = active_component(reply)["data"]["ai_proposal"]
assert proposal_data["optimized_description"]
def test_revise_without_instruction_rejected(client: Any) -> None:
session_id, body = create_builder_session(client)
card = start_education(client, session_id, body)
proposal = finish_education(client, session_id, card, "完成数据库课程项目。GPA: 4.3/5.0。")
response = _revise(client, session_id, proposal, {})
assert response.status_code == 422, response.text
def test_revise_without_pending_proposal_rejected(client: Any) -> None:
session_id, body = create_builder_session(client)
response = _revise(client, session_id, body, {"instruction": "重新优化"})
assert response.status_code in (404, 409, 422), response.text