generated from kgod/ai-review-template
feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""Tests for the unified target-position write path."""
|
||||
|
||||
from app.optimization_models import TargetPositionRequest
|
||||
|
||||
|
||||
def test_target_position_request_validation():
|
||||
request = TargetPositionRequest(target_position=" 数据分析师 ")
|
||||
|
||||
assert request.target_position == " 数据分析师 "
|
||||
|
||||
|
||||
def test_set_target_position_updates_profile():
|
||||
from app.optimization_flow import OptimizationFlowMixin
|
||||
|
||||
class FakeDatabase:
|
||||
def __init__(self):
|
||||
self.session = {
|
||||
"id": "s1",
|
||||
"stage": "RESUME_ENRICHING",
|
||||
"revision": 3,
|
||||
"profile": {"job_type": "校招"},
|
||||
"draft_id": None,
|
||||
"resume_id": "r1",
|
||||
}
|
||||
|
||||
def transaction(self, immediate=False):
|
||||
class Context:
|
||||
def __enter__(self_inner):
|
||||
return object()
|
||||
|
||||
def __exit__(self_inner, *args):
|
||||
return False
|
||||
|
||||
return Context()
|
||||
|
||||
def update_session(self, connection, session_id, *, stage, profile, **kwargs):
|
||||
self.session["profile"] = profile
|
||||
return self.session
|
||||
|
||||
class Service(OptimizationFlowMixin):
|
||||
pass
|
||||
|
||||
service = Service()
|
||||
service.database = FakeDatabase()
|
||||
service._session_or_404 = lambda connection, session_id: service.database.session
|
||||
|
||||
result = service.set_target_position("s1", " 数据分析师 ")
|
||||
|
||||
assert result == {
|
||||
"target_position": "数据分析师",
|
||||
"target_position_confirmed": True,
|
||||
}
|
||||
assert service.database.session["profile"]["target_position"] == "数据分析师"
|
||||
assert service.database.session["profile"]["target_position_confirmed"] is True
|
||||
assert service.database.session["profile"]["job_type"] == "校招"
|
||||
Reference in New Issue
Block a user