Generate event rule documentation

This commit is contained in:
Luna 2026-06-15 18:52:28 -07:00
parent e43d7689a0
commit 7f4d5b42fd
8 changed files with 378 additions and 5 deletions

View file

@ -66,6 +66,14 @@ exec_comm = ["id"]
alerts = ruleops.test_event(cfg, event)
self.assertIn(100060, {a.sid for a in alerts})
def test_render_markdown_documents_rules(self):
text = ruleops.render_markdown(Config())
self.assertIn("# Enodia Sentinel Event Rule Reference", text)
self.assertIn("## SID 100002:", text)
self.assertIn("Expected false positives:", text)
self.assertIn("Drill or fixture:", text)
self.assertIn("`argv_regex`", text)
class TestRulesCli(unittest.TestCase):
def setUp(self):
@ -123,6 +131,13 @@ class TestRulesCli(unittest.TestCase):
self.assertEqual(code, 1)
self.assertIn("No rules matched", out)
def test_docs_text(self):
code, out = self._run("docs")
self.assertEqual(code, 0)
self.assertIn("Enodia Sentinel Event Rule Reference", out)
self.assertIn("SID 100060", out)
self.assertIn("Expected false positives", out)
if __name__ == "__main__":
unittest.main()