feat: unify SSH and Windows daily report layout in SAC and UI
Agent-style report body for SAC aggregation; shared stats cards; RDP ban note in docs Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -145,6 +145,44 @@ def test_generate_creates_report_and_notifies(db_session):
|
||||
assert ev.details.get("generated_by") == "sac"
|
||||
|
||||
|
||||
def test_generate_rdp_report_unified_format(db_session):
|
||||
h = Host(
|
||||
hostname="win-srv",
|
||||
display_name="RDCB",
|
||||
ipv4="10.0.0.5",
|
||||
os_family="windows",
|
||||
product="rdp-login-monitor",
|
||||
last_seen_at=datetime.now(timezone.utc),
|
||||
)
|
||||
db_session.add(h)
|
||||
db_session.flush()
|
||||
now = datetime.now(timezone.utc)
|
||||
db_session.add(
|
||||
Event(
|
||||
event_id=str(uuid.uuid4()),
|
||||
host_id=h.id,
|
||||
occurred_at=now,
|
||||
category="auth",
|
||||
type="rdp.login.success",
|
||||
severity="info",
|
||||
title="ok",
|
||||
summary="",
|
||||
details={"user": "admin"},
|
||||
payload={},
|
||||
)
|
||||
)
|
||||
db_session.commit()
|
||||
cfg = _cfg()
|
||||
with patch("app.services.daily_report.notify_daily_report"):
|
||||
res = generate_daily_report_for_host(db_session, h, cfg)
|
||||
assert res and res.created
|
||||
ev = db_session.scalar(select(Event).where(Event.type == "report.daily.rdp"))
|
||||
body = ev.details.get("report_body", "")
|
||||
assert "ЕЖЕДНЕВНЫЙ ОТЧЕТ МОНИТОРИНГА WINDOWS" in body
|
||||
assert "RDCB (10.0.0.5)" in body
|
||||
assert "АКТИВНЫЕ ПОЛЬЗОВАТЕЛИ" in body
|
||||
|
||||
|
||||
def test_run_daily_reports_respects_hour(db_session):
|
||||
h = _ssh_host(db_session)
|
||||
db_session.commit()
|
||||
|
||||
Reference in New Issue
Block a user