Spaces:
Sleeping
Sleeping
| import pytest | |
| from app.services import approved_profile_staging | |
| from app.services.explicit_profile_capture import capture_explicit_profile_signal | |
| 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"] | |
| 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 == [] | |