From 2cbfbc2589ba2c8ab825480c8b392775c447ff9a Mon Sep 17 00:00:00 2001 From: TOUFIKI Zakarya Date: Tue, 30 Jul 2024 17:43:09 +0200 Subject: [PATCH] Fix the way to update status --- .../SekoiaXDRChangeStatus.py | 20 +++---------------- .../SekoiaXDRChangeStatus_test.py | 3 --- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus.py b/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus.py index 7f5f3baff6b3..31f5f4bd87a2 100644 --- a/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus.py +++ b/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus.py @@ -20,25 +20,11 @@ def post_comment(alert_short_id: str, comment: Optional[str], author: str): ) -def update_status(MirrorEnable: str, alert_short_id: str, new_status: str): - if MirrorEnable in ["Out", "Both"]: - execute_command("setIncident", {"sekoiaalertstatus": new_status}) - elif MirrorEnable == "In": - execute_command( - "sekoia-xdr-update-status-alert", - {"id": alert_short_id, "status": new_status}, - ) - else: - execute_command( - "sekoia-xdr-update-status-alert", - {"id": alert_short_id, "status": new_status}, - ) - execute_command("setIncident", {"sekoiaalertstatus": new_status}) +def update_status(new_status: str): + execute_command("setIncident", {"sekoiaalertstatus": new_status}) def main(): - incident = demisto.incidents()[0] # type: ignore - isMirrorEnable = incident.get("dbotMirrorDirection") alert_short_id = demisto.args()["short_id"] new_status = demisto.args()["status"] comment = demisto.args().get("comment") @@ -46,7 +32,7 @@ def main(): if new_status in ["Ongoing", "Acknowledged"]: if comment: post_comment(alert_short_id, comment, get_username()) - update_status(isMirrorEnable, alert_short_id, new_status) + update_status(alert_short_id) readable_output = f"### Status of the alert changed to:\n {new_status}" return_results( { diff --git a/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus_test.py b/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus_test.py index 432923a4b140..dbe2eb950a0f 100644 --- a/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus_test.py +++ b/Packs/SekoiaXDR/Scripts/SekoiaXDRChangeStatus/SekoiaXDRChangeStatus_test.py @@ -11,9 +11,6 @@ def test_get_username(mocker): def test_main(mocker): - mocker.patch.object( - demisto, "incidents", return_value=[{"dbotMirrorDirection": "In"}] - ) mocker.patch.object( demisto, "args",