fix clear investi

This commit is contained in:
larssand
2026-07-06 16:49:30 +02:00
parent 49ac7e2958
commit 649c29a8c2
8 changed files with 88 additions and 7 deletions

View File

@@ -37,3 +37,17 @@ class IncidentTests(unittest.TestCase):
first = build_incidents([], {"alice": [{"score": 15, "reason": "new login country", "stream_id": "windows"}]}, [])[0]
second = build_incidents([], {"alice": [{"score": 25, "reason": "new source ip", "stream_id": "windows"}]}, [])[0]
self.assertEqual(first["id"], second["id"])
def test_incident_store_can_clear_resolved_or_all_states(self):
with tempfile.TemporaryDirectory() as directory:
store = IncidentStore(str(Path(directory) / "incidents.json"))
store.update("one", "resolved")
store.update("two", "acknowledged")
resolved = store.clear(status="resolved")
self.assertEqual(resolved, {"removed": 1, "remaining": 1, "status": "resolved"})
self.assertEqual(set(store.entries()), {"two"})
all_items = store.clear()
self.assertEqual(all_items, {"removed": 1, "remaining": 0, "status": "all"})
self.assertEqual(store.entries(), {})