fix: test push errors, skip heartbeat notify, stale 5h (0.9.2)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-10 17:25:16 +10:00
parent 5e9f0f8110
commit f9baf96d88
7 changed files with 69 additions and 7 deletions
+32
View File
@@ -64,6 +64,38 @@ def test_notify_event_calls_selected_channels():
mock_em.notify_event.assert_not_called()
def test_notify_event_skips_agent_heartbeat():
event = Event(
event_id="00000000-0000-4000-8000-000000000404",
host_id=1,
occurred_at=datetime(2026, 5, 29, 15, 0, tzinfo=timezone.utc),
category="agent",
type="agent.heartbeat",
severity="info",
title="heartbeat",
summary="skip",
payload={},
)
policy = NotificationPolicyConfig(
min_severity="info",
use_telegram=True,
use_webhook=True,
use_email=True,
use_mobile=True,
source="db",
)
with patch.object(notify_dispatch, "get_effective_notification_policy", return_value=policy):
with patch.object(notify_dispatch, "telegram_notify") as mock_tg:
with patch.object(notify_dispatch, "webhook_notify") as mock_wh:
with patch.object(notify_dispatch, "email_notify") as mock_em:
with patch.object(notify_dispatch, "mobile_notify") as mock_mob:
notify_dispatch.notify_event(event)
mock_tg.notify_event.assert_not_called()
mock_wh.notify_event.assert_not_called()
mock_em.notify_event.assert_not_called()
mock_mob.notify_event.assert_not_called()
def test_notify_event_skipped_by_cooldown():
event = Event(
event_id="00000000-0000-4000-8000-000000000403",