generated from kgod/ai-review-template
feat: initialize resume agent with OfferPai sync
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
|
||||
BACKEND_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(BACKEND_ROOT))
|
||||
|
||||
from app.main import create_app # noqa: E402
|
||||
from app.services import ( # noqa: E402
|
||||
RuleBasedEntryExpander,
|
||||
RuleBasedExperienceExtractor,
|
||||
RuleBasedResumeRewriter,
|
||||
)
|
||||
from app.settings import Settings # noqa: E402
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _intent_router_off_in_tests(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Keep the LLM intent gate hermetic: rescue.py lazy-loads global settings,
|
||||
so a developer .env with RESUME_AGENT_INTENT_ROUTER_MODE=on must not leak
|
||||
real LLM calls into the suite. Tests that need the gate stub the classifier
|
||||
on the agent directly."""
|
||||
monkeypatch.setattr(
|
||||
"app.builder_conversation.rescue.load_settings",
|
||||
lambda: Settings(llm_provider="rule", intent_router_mode="off"),
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client(tmp_path: Path) -> TestClient:
|
||||
application = create_app(
|
||||
database_path=tmp_path / "test.db",
|
||||
cors_origins=["http://localhost:5173"],
|
||||
extractor=RuleBasedExperienceExtractor(),
|
||||
rewriter=RuleBasedResumeRewriter(),
|
||||
expander=RuleBasedEntryExpander(),
|
||||
settings=Settings(llm_provider="rule", offerpai_auth_required=False),
|
||||
)
|
||||
with TestClient(application) as test_client:
|
||||
yield test_client
|
||||
Reference in New Issue
Block a user