fix stream name

This commit is contained in:
larssand
2026-06-25 18:43:00 +02:00
parent b6560d64f7
commit c6274f840a
3 changed files with 33 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import tempfile
import json
import unittest
from pathlib import Path
from unittest.mock import patch
@@ -34,6 +35,24 @@ class MonitorTests(unittest.TestCase):
self.assertTrue(output.exists())
def test_profile_readiness_includes_stream_and_profile_names(self):
with tempfile.TemporaryDirectory() as tmp:
config_path = Path(tmp) / "config.json"
config_path.write_text(
json.dumps(
{
"graylog_streams": [{"id": "66fe", "title": "Fortigate", "enabled": True}],
"graylog_stream_profiles": [{"stream_id": "66fe", "name": "Firewall baseline", "entity_field": "srcip", "categorical_fields": ["action"]}],
}
),
encoding="utf-8",
)
with patch("fgai.monitor.BaselineStore.profile_readiness", return_value=[{"stream_id": "66fe", "field": "action", "buckets": 12, "ready": True}]):
status = build_status(str(Path(tmp) / "missing.log"), baseline_path=str(Path(tmp) / "baseline.sqlite3"), config_path=str(config_path))
self.assertEqual(status["profile_readiness"][0]["stream_name"], "Fortigate")
self.assertEqual(status["profile_readiness"][0]["profile_name"], "Firewall baseline")
def test_add_llm_assessment_records_error_without_ollama(self):
status = {"summary": {}, "anomalies": []}