From 751ae885db93ee9fc5b2e4c8128a24e0f6ff15dc Mon Sep 17 00:00:00 2001 From: Andrey Epifancev Date: Fri, 23 Oct 2026 22:41:27 +0400 Subject: [PATCH] =?UTF-8?q?test:=20=D1=82=D0=B8=D0=BA=20=D1=83=D0=B1=D0=B8?= =?UTF-8?q?=D1=80=D0=B0=D0=B5=D1=82=20downloads/=20=D1=80=D0=B0=D0=B7=20?= =?UTF-8?q?=D0=B2=20=D1=81=D1=83=D1=82=D0=BA=D0=B8=20(#87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- tests/test_api.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_api.py b/tests/test_api.py index 8da70e5..06dd59e 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -753,6 +753,26 @@ def test_tick_sweeps_files_once_a_day(hub, tmp_path, monkeypatch): assert len(calls) == 2 +def test_tick_sweeps_downloads_once_a_day(hub): + h = hub["hub"] + old = time.time() - 31 * 86400 + + def put_old(name): + d = h.db_path.parent / "downloads" / name + d.mkdir(parents=True) + (d / "a.png").write_bytes(b"x") + os.utime(d / "a.png", (old, old)) + os.utime(d, (old, old)) + return d + + first = put_old("1") + h.tick() + assert not first.exists() and "downloads_at" in h.module_state["jira"] + second = put_old("2") + h.tick() + assert second.exists() # второй тик в те же сутки — без уборки + + def test_tick_sweep_failure_logged_auto_refresh_still_runs(hub, monkeypatch, caplog, add_project): _add_project(hub, add_project) def broken(*args, **kwargs):