from __future__ import annotations import pytest from backend.oracle.persona_service import persona_service @pytest.mark.asyncio async def test_persona_plan_recommends_templates_for_pipeline_prompt() -> None: plan = await persona_service.plan_for_prompt( prompt="Show me a pipeline map and broker trend view for marina whales", tenant_id="tenant_velocity", actor_role="sales_director", ) assert "tpl_pipeline_board_v2" in plan["recommendedTemplates"] assert plan["canvasBlocks"][0]["type"] == "textCanvas" @pytest.mark.asyncio async def test_persona_render_uses_existing_prompt_files() -> None: rendered = await persona_service.render_prompt( prompt_name="qd_calculator", variables={"lead_name": "Amina", "query": "Summarize buyer intent"}, ) assert rendered["promptName"] == "qd_calculator" assert "Amina" in rendered["renderedPrompt"] or rendered["unresolvedVariables"] is not None