test: оценка пакета на реальном модуле jira вместо commands.estimate (#87)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andrey Epifancev 2026-10-23 22:23:00 +04:00
parent c9ac2d5238
commit bc4e8a288f
2 changed files with 8 additions and 1 deletions

View File

@ -1205,3 +1205,10 @@ def test_request_fetch_after_done_file_swept(fconn, tmp_path):
r = jira_fetch.request_fetch(fconn, root, "31337", "x")
assert r["state"] == "fetching"
assert fconn.execute("SELECT COUNT(*) AS n FROM command WHERE type = 'fetch_attachment'").fetchone()["n"] == 2
def test_estimate_sums_module_pauses_replaces_commands_estimate(conn):
"""Замена утверждения test_commands про commands.estimate (функция ушла в ядро): сумма пауз реального модуля jira
через pacing -> hooks.pause -> queue.estimate."""
settings.set_(conn, "pacing", {"ensure_fields": 120, "ensure_comment": 30, "refresh": 2})
assert queue.estimate(conn, ["ensure_fields", "ensure_comment", "refresh"]) == 152

View File

@ -24,7 +24,7 @@ def make_stub(events, refs=()):
tail=lambda cmds: {"type": "r", "params": {}} if any(c["type"] == "w" for c in cmds) else None,
pause=lambda conn, ctype: 7, deliver_params=lambda conn, cmd, files_dir: cmd["params"],
temp_definer=None, temp_keys_used=lambda cmd: [], substitute=lambda t, p, m: p,
drop_unresolved=lambda params, unresolved: unresolved, retry_params=lambda cmd: cmd["params"],
drop_unresolved=lambda cmd, unresolved: unresolved, retry_params=lambda cmd: cmd["params"],
check_confirmed=lambda conn, cmd: (False, None), on_claim=lambda *a: None, on_failed=lambda *a: None,
check_result=lambda conn, cmd, status, result, files_dir: (status, None),
on_result=lambda conn, cmd, status, *a: events.append(("on_result", cmd["type"], status)),