from fastapi.testclient import TestClient from esp32_http_server import app def test_job_recog_payload_contains_threshold_and_uid(): c = TestClient(app) r = c.post("/job/recog", params={"threshold": 0.41, "uid": "04:aa:bb:cc"}) assert r.status_code == 200 j = r.json()["job"] assert j["type"] == "RECOG" assert abs(float(j["threshold"]) - 0.41) < 1e-6 assert j["uid"] == "04:AA:BB:CC" r2 = c.get("/job/next", params={"device": "esp32"}) assert r2.status_code == 200 job = r2.json()["job"] assert job is not None assert job["type"] == "RECOG" assert abs(float(job["threshold"]) - 0.41) < 1e-6 assert job["uid"] == "04:AA:BB:CC"