Remove interact verify endpoint
All checks were successful
python-syntax / syntax-check (push) Successful in 31s
All checks were successful
python-syntax / syntax-check (push) Successful in 31s
This commit is contained in:
@@ -112,37 +112,3 @@ def test_see_ocr_off_on_contract(monkeypatch):
|
||||
on = client.post("/see", json={"ocr": True, "with_grid": False}, headers=_auth_headers())
|
||||
assert on.status_code == 200
|
||||
assert on.json()["data"]["meta"]["ocr"][0]["text"] == "x"
|
||||
|
||||
|
||||
def test_interact_verify_success_and_timeout(monkeypatch):
|
||||
calls = {"n": 0}
|
||||
monkeypatch.setattr(services, "exec_action", lambda action, screen=0: {"action": action.action, "executed": True})
|
||||
|
||||
def fake_verify(_spec):
|
||||
calls["n"] += 1
|
||||
return {"ok": calls["n"] >= 2, "matches": [], "items_count": 1, "screen": {"selected": 0}, "region": {"x": 0, "y": 0, "width": 1, "height": 1}}
|
||||
|
||||
monkeypatch.setattr(services, "_verify_ocr_text_near_point", fake_verify)
|
||||
client = TestClient(app)
|
||||
payload = {
|
||||
"action": {"screen": 0, "action": {"action": "type", "text": "hello"}},
|
||||
"verify": {"type": "ocr_text_near_point", "text": "hello", "x": 100, "y": 100},
|
||||
"check_interval_ms": 50,
|
||||
"timeout_ms": 500,
|
||||
}
|
||||
ok_resp = client.post("/interact/verify", json=payload, headers=_auth_headers())
|
||||
assert ok_resp.status_code == 200
|
||||
ok_data = ok_resp.json()["data"]
|
||||
assert ok_data["verified"] is True
|
||||
assert ok_data["attempts"] == 2
|
||||
|
||||
monkeypatch.setattr(
|
||||
services,
|
||||
"_verify_ocr_text_near_point",
|
||||
lambda _spec: {"ok": False, "matches": [], "items_count": 0, "screen": {"selected": 0}, "region": {"x": 0, "y": 0, "width": 1, "height": 1}},
|
||||
)
|
||||
timeout_resp = client.post("/interact/verify", json=payload, headers=_auth_headers())
|
||||
assert timeout_resp.status_code == 200
|
||||
timeout_data = timeout_resp.json()["data"]
|
||||
assert timeout_data["verified"] is False
|
||||
assert timeout_data["attempts"] >= 1
|
||||
|
||||
Reference in New Issue
Block a user