feat(sync): sync_wa_voice_calls + scheduler ENTITY_FUNCS wa_voice_calls

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-07 09:36:14 +08:00
parent 169a64ee29
commit 18620870c6
4 changed files with 48 additions and 9 deletions
+5 -3
View File
@@ -471,8 +471,8 @@ async def test_failing_message_scraper_records_failed_run(monkeypatch):
async def test_sync_all_wechat_runs_each_entity_then_messages(monkeypatch):
"""The coordinator runs departments → accounts → friends → groups →
voice_calls, then per-conversation messages for an explicit list.
Returns one result per entity/conversation in order."""
voice_calls → wa_voice_calls, then per-conversation messages for an
explicit list. Returns one result per entity/conversation in order."""
engine = await _make_engine()
try:
SessionLocal = async_sessionmaker(engine, expire_on_commit=False)
@@ -490,6 +490,7 @@ async def test_sync_all_wechat_runs_each_entity_then_messages(monkeypatch):
monkeypatch.setattr(orchestrator, "scrape_wechat_friends", empty_async_gen)
monkeypatch.setattr(orchestrator, "scrape_wechat_groups", empty_async_gen)
monkeypatch.setattr(orchestrator, "scrape_wechat_voice_calls", empty_async_gen)
monkeypatch.setattr(orchestrator, "scrape_wa_voice_calls", empty_async_gen)
monkeypatch.setattr(orchestrator, "scrape_wechat_messages", empty_messages)
# Scrapers yield nothing -> upsert / media loops never execute, so the
# real upsert_messages / download_message_media (also imported into the
@@ -510,13 +511,14 @@ async def test_sync_all_wechat_runs_each_entity_then_messages(monkeypatch):
await session.commit()
entities = [r.entity for r in results]
# Five full-re-scrape entities in order, then two message runs.
# Six full-re-scrape entities in order, then two message runs.
assert entities == [
"department",
"wechat_account",
"wechat_friend",
"wechat_group",
"wechat_voice_call",
"wa_voice_call",
"message",
"message",
]