feat(realestate): wire cleanup + notifier into scheduled flow
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
30
realestate-lab/tests/test_scheduled_flow.py
Normal file
30
realestate-lab/tests/test_scheduled_flow.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
def test_scheduled_collect_calls_cleanup_and_notifier():
|
||||
from app import main as app_main
|
||||
|
||||
calls = []
|
||||
|
||||
def fake_collect():
|
||||
calls.append("collect")
|
||||
return {"new_count": 0, "total_count": 0}
|
||||
|
||||
def fake_cleanup(grace_days=90):
|
||||
calls.append(("cleanup", grace_days))
|
||||
return 0
|
||||
|
||||
def fake_match():
|
||||
calls.append("match")
|
||||
|
||||
def fake_notify():
|
||||
calls.append("notify")
|
||||
return {"sent": 0}
|
||||
|
||||
with patch.object(app_main, "collect_all", side_effect=fake_collect), \
|
||||
patch.object(app_main, "delete_old_completed_announcements", side_effect=fake_cleanup), \
|
||||
patch.object(app_main, "run_matching", side_effect=fake_match), \
|
||||
patch.object(app_main, "notify_new_matches", side_effect=fake_notify):
|
||||
app_main.scheduled_collect()
|
||||
|
||||
assert calls == ["collect", ("cleanup", 90), "match", "notify"]
|
||||
Reference in New Issue
Block a user