fix(контракт): mock — правки DeepSeek второго круга (R-03)

Отзыв устройства отвечает ok:false, если отзывать нечего; fail не переписывает уже
закрытую проверку; событие потока для abandoned не выдаётся за done. Проверки mock: 19,
отпечаток набора и перечень обновлены.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 19:30:51 +10:00
co-authored by Claude Code
parent b2b9e9b545
commit 231922b6e6
4 changed files with 32 additions and 8 deletions
+20
View File
@@ -350,3 +350,23 @@ def test_tool_choice_for_absent_function_makes_no_call(device):
"function": {"name": "find_base_price"}}},
headers=dict(h, **{"X-Tab-Id": "mock-tab-1"}))
assert "tool_calls" not in r.text and "Заглушка mock" in r.text
def test_revoke_reports_whether_device_found(device):
c = device["client"]
missing = c.post("/api/device/revoke", json={"id": 999}, headers=device["site"])
assert missing.status_code == 200 and missing.json() == {"ok": False}
real = c.post("/api/device/revoke", json={"id": device["token"]["device_id"]},
headers=device["site"])
assert real.json() == {"ok": True}
def test_fail_does_not_rewrite_closed_review(device):
c, h = device["client"], device["headers"]
rid = c.post("/api/reviews", json={"confirmed": True, "items": [{"ord": 1, "text": "x"}],
"budget_rub": 10}, headers=h).json()["id"]
c.post(f"/api/reviews/{rid}/cancel", headers=device["site"])
r = c.post(f"/api/reviews/{rid}/fail", json={"reason": "поздно"}, headers=h)
assert r.status_code == 200 and r.json() == {"ok": True}
detail = c.get(f"/api/reviews/{rid}", headers=device["site"]).json()["review"]
assert detail["status"] == "stopped" and detail["error"] is None