fix: Seaca push uses same lifecycle text as Telegram (0.9.11)
Reuse telegram templates for FCM title/body so agent start/restart reasons reach mobile without Seaca app changes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,10 +1,33 @@
|
||||
"""FCM push must not break event ingest."""
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.mobile_notify import MobileNotConfiguredError, _send_fcm_data
|
||||
from app.models import Event, Host
|
||||
from app.services.mobile_notify import MobileNotConfiguredError, _event_payload, _send_fcm_data
|
||||
|
||||
|
||||
def test_event_payload_lifecycle_uses_telegram_wording():
|
||||
host = Host(hostname="WIN01", display_name="K6A-DC3", os_family="windows")
|
||||
event = Event(
|
||||
event_id="00000000-0000-4000-8000-000000000511",
|
||||
host_id=1,
|
||||
host=host,
|
||||
occurred_at=datetime(2026, 5, 29, 9, 0, tzinfo=timezone.utc),
|
||||
category="agent",
|
||||
type="agent.lifecycle",
|
||||
severity="info",
|
||||
title="started",
|
||||
summary="short",
|
||||
details={"lifecycle": "started", "trigger": "settings_reload", "telegram_via": "sac"},
|
||||
payload={"source": {"product": "ssh-monitor", "product_version": "1.4.0-SAC"}},
|
||||
)
|
||||
title, body, data = _event_payload(event)
|
||||
assert title == "✅ Агент запущен"
|
||||
assert "graceful restart" in body
|
||||
assert data["type"] == "agent.lifecycle"
|
||||
|
||||
|
||||
def test_send_fcm_data_swallows_token_errors_by_default():
|
||||
|
||||
Reference in New Issue
Block a user