fix clear investi
This commit is contained in:
@@ -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(), {})
|
||||
|
||||
Reference in New Issue
Block a user