Spaces:
Sleeping
Sleeping
File size: 1,188 Bytes
2e818da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import pytest
from app.services import approved_profile_staging
from app.services.explicit_profile_capture import capture_explicit_profile_signal
@pytest.mark.asyncio
async def test_capture_stages_approved_name_candidate(tmp_path, monkeypatch):
monkeypatch.setattr(approved_profile_staging, "_ROOT", tmp_path)
await capture_explicit_profile_signal(
project_id="project-a", interaction_id="interaction-1", user_text="Please call me Anshuman.",
)
candidates, _, _ = approved_profile_staging.read_pending("project-a")
assert len(candidates) == 1
assert candidates[0].kind == "preferred_name"
assert candidates[0].attribution == "explicit_student"
assert candidates[0].interaction_ids == ["interaction-1"]
@pytest.mark.asyncio
async def test_capture_does_nothing_when_no_name_pattern_matches(tmp_path, monkeypatch):
monkeypatch.setattr(approved_profile_staging, "_ROOT", tmp_path)
await capture_explicit_profile_signal(
project_id="project-a", interaction_id="interaction-1", user_text="I am confused about robotics.",
)
candidates, _, _ = approved_profile_staging.read_pending("project-a")
assert candidates == []
|