Use Ollama rewrite path for CV generation

This commit is contained in:
2026-04-11 22:26:03 +02:00
parent 591c9b8a64
commit 54abc9f546
4 changed files with 223 additions and 5 deletions
+18
View File
@@ -76,6 +76,24 @@ def test_health_reports_ollama_unreachable_when_configured_but_not_available(mon
assert payload["ollama_model_available"] is False
def test_rewrite_cv_returns_plain_rewritten_text(monkeypatch):
module = load_app_module(monkeypatch, ollama_model="qwen2.5:7b")
monkeypatch.setattr(module, "_ollama_generate_text", lambda prompt: "# Professional Summary\nBuilt resilient backend systems.\n\n# Skills\n- C#\n- .NET")
client = TestClient(module.app)
response = client.post("/cv/rewrite", json={
"instruction": "Rewrite this CV into a cleaner master CV.",
"text": "Professional Summary\nBuilt backend systems.",
"max_length": 220,
"min_length": 80,
})
assert response.status_code == 200
payload = response.json()
assert payload["rewritten_text"].startswith("# Professional Summary")
assert "Role summary:" not in payload["rewritten_text"]
def test_classify_block_returns_structured_json(monkeypatch):
module = load_app_module(monkeypatch)