Fix fudai diagnostics and redpacket guard
This commit is contained in:
1 parent
cb74a23e81
commit
28709d2d97
11 files changed
+245
-4
No files matched your search
@@ -223,6 +223,40 @@ class TestSaveImageModule:
|
||||
if g >= 160 and r <= 80 and b <= 120:
|
||||
green_pixels += 1
|
||||
assert green_pixels > 20
|
||||
|
||||
def test_maybe_auto_cleanup_skips_repeated_same_day_over_limit_scan(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
from datetime import datetime
|
||||
from douyin.handlers.screenshot_manager import save_image_helpers as helpers
|
||||
|
||||
debug_base = tmp_path / "debug_captures"
|
||||
debug_base.mkdir()
|
||||
today = datetime.now().strftime("%Y-%m-%d")
|
||||
(debug_base / ".cleanup_marker").write_text(today, encoding="utf-8")
|
||||
config_path = tmp_path / "config.json"
|
||||
config_path.write_text(
|
||||
'{"debug_captures":{"max_files":1}}',
|
||||
encoding="utf-8",
|
||||
)
|
||||
calls = {"count": 0}
|
||||
|
||||
monkeypatch.setattr(helpers, "get_debug_captures_base_dir", lambda: str(debug_base))
|
||||
monkeypatch.setattr(
|
||||
"douyin.handlers.screenshot_manager.save_image_helpers.path_config.get_config_path",
|
||||
lambda: str(config_path),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
helpers,
|
||||
"count_debug_captures_files",
|
||||
lambda: calls.__setitem__("count", calls["count"] + 1) or 2,
|
||||
)
|
||||
monkeypatch.setattr(helpers, "cleanup_debug_captures", lambda **_kwargs: 0)
|
||||
|
||||
helpers.maybe_auto_cleanup(True, lambda _msg: None)
|
||||
helpers.maybe_auto_cleanup(True, lambda _msg: None)
|
||||
|
||||
assert calls["count"] == 1
|
||||
|
||||
|
||||
class TestScreenshotManagerSubmodules:
|
||||
|
||||
Reference in new issue
Block a user