feat: add summary configuration and sync controls
This commit is contained in:
@ -107,3 +107,30 @@ def test_sync_all_chats_for_day_saves_only_dated_messages_with_direction():
|
||||
assert [row.direction for row in outgoing] == ["out"]
|
||||
assert len(client.feed_calls) == 2
|
||||
assert client.history_calls[0][2]["visible_only"] is True
|
||||
|
||||
|
||||
def test_sync_all_chats_for_day_excludes_configured_chat_before_history_pull():
|
||||
from snooper_history import sync_all_chats_for_day
|
||||
|
||||
tz = ZoneInfo("Asia/Shanghai")
|
||||
start_ts = 1_792_000_000
|
||||
client = FakeClient(start_ts)
|
||||
client.auth = type("Auth", (), {"user_id": "self"})()
|
||||
storage = Storage(url="sqlite:///:memory:")
|
||||
|
||||
stats = sync_all_chats_for_day(
|
||||
client,
|
||||
storage,
|
||||
date(2026, 11, 3),
|
||||
tz,
|
||||
batch_size=2,
|
||||
start_ts=start_ts,
|
||||
end_ts=start_ts + 86_400,
|
||||
exclude_chat_ids=["private-b"],
|
||||
)
|
||||
|
||||
assert stats["chats"] == 1
|
||||
assert stats["matched"] == 1
|
||||
assert stats["saved"] == 1
|
||||
assert [call[0] for call in client.history_calls] == ["group-a"]
|
||||
assert storage.get_messages("private-b") == []
|
||||
|
||||
Reference in New Issue
Block a user