59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
"""serialize_manager_candidate now carries ATS score + band for the HM table."""
|
|
|
|
from job.candidate.serializers import serialize_manager_candidate
|
|
|
|
|
|
def test_manager_row_exposes_ats_from_nested_result():
|
|
row = serialize_manager_candidate(
|
|
{
|
|
"inbox_id": 9,
|
|
"user_id": "11111111-1111-1111-1111-111111111111",
|
|
"name": "Ada",
|
|
"email": "ada@example.com",
|
|
"title": "Backend Engineer",
|
|
"application_status": "REJECTED",
|
|
"assigned_job_post_id": "22222222-2222-2222-2222-222222222222",
|
|
"created_at": "2026-09-03T10:00:00",
|
|
"ats_result": {"overall_score": 88.0, "band": "Strong Match"},
|
|
},
|
|
source="inbox",
|
|
)
|
|
assert row["ai_score"] == 88.0
|
|
assert row["recommendation"] == "Strong Match"
|
|
assert row["application_status"] == "REJECTED"
|
|
assert row["job_title"] == "Backend Engineer"
|
|
|
|
|
|
def test_manager_row_derives_band_when_missing():
|
|
row = serialize_manager_candidate(
|
|
{
|
|
"id": "33333333-3333-3333-3333-333333333333",
|
|
"user_id": "44444444-4444-4444-4444-444444444444",
|
|
"candidate_email": "m@example.com",
|
|
"name": "Manual",
|
|
"title": "Brand Manager",
|
|
"application_status": "PENDING",
|
|
"job_post_id": "55555555-5555-5555-5555-555555555555",
|
|
"ats_result": {"overall_score": 70},
|
|
},
|
|
source="manual",
|
|
)
|
|
assert row["ai_score"] == 70
|
|
assert row["recommendation"] == "Potential Match"
|
|
|
|
|
|
def test_manager_row_unscored_stays_empty():
|
|
row = serialize_manager_candidate(
|
|
{
|
|
"inbox_id": 1,
|
|
"user_id": "66666666-6666-6666-6666-666666666666",
|
|
"name": "New",
|
|
"email": "n@example.com",
|
|
"title": "Role",
|
|
"application_status": "CLOSED",
|
|
},
|
|
source="inbox",
|
|
)
|
|
assert row["ai_score"] is None
|
|
assert row["recommendation"] is None
|