diff --git a/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert.py b/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert.py index 0ce0f891213f..b686d0818622 100644 --- a/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert.py +++ b/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert.py @@ -42,26 +42,38 @@ def close_alert( close_notes: Optional[str], username: str, mirror_status: str, - is_mirror_out: bool + is_mirror_out: bool, ): readable_output = "" alert_status = get_status_name(alert_id) if alert_status not in ["Closed", "Rejected"]: if reject == "false": if mirror_status == "In" and is_mirror_out: - execute_command("sekoia-xdr-update-status-alert", {"id": alert_id, "status": "Closed"}) + execute_command( + "sekoia-xdr-update-status-alert", + {"id": alert_id, "status": "Closed"}, + ) elif mirror_status is None and is_mirror_out: execute_command("setIncident", {"sekoiaxdralertstatus": "Closed"}) - execute_command("sekoia-xdr-update-status-alert", {"id": alert_id, "status": "Closed"}) + execute_command( + "sekoia-xdr-update-status-alert", + {"id": alert_id, "status": "Closed"}, + ) else: execute_command("setIncident", {"sekoiaxdralertstatus": "Closed"}) readable_output = f"**** The alert {alert_id} has been closed. ****" if reject == "true": if mirror_status == "In" and is_mirror_out: - execute_command("sekoia-xdr-update-status-alert", {"id": alert_id, "status": "Rejected"}) + execute_command( + "sekoia-xdr-update-status-alert", + {"id": alert_id, "status": "Rejected"}, + ) elif mirror_status is None and is_mirror_out: execute_command("setIncident", {"sekoiaxdralertstatus": "Closed"}) - execute_command("sekoia-xdr-update-status-alert", {"id": alert_id, "status": "Rejected"}) + execute_command( + "sekoia-xdr-update-status-alert", + {"id": alert_id, "status": "Rejected"}, + ) else: execute_command("setIncident", {"sekoiaxdralertstatus": "Rejected"}) readable_output = f"**** The alert {alert_id} has been rejected. ****" @@ -92,7 +104,7 @@ def main(): close_notes = demisto.getArg("closeNotes") username = demisto.getArg("closingUserId") # type: ignore close_alert( - alert_short_id, reject, close_reason, close_notes, username, mirror_direction, is_mirror_out # type: ignore + alert_short_id, reject, close_reason, close_notes, username, mirror_direction, is_mirror_out # type: ignore ) diff --git a/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert_test.py b/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert_test.py index 0d753d1eb1aa..eb0edeccfc4e 100644 --- a/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert_test.py +++ b/Packs/SekoiaXDR/Scripts/SekoiaXDRCloseAlert/SekoiaXDRCloseAlert_test.py @@ -1,7 +1,12 @@ import demistomock as demisto import SekoiaXDRCloseAlert # type: ignore -from SekoiaXDRCloseAlert import get_status_name, get_username, \ - post_closure_comment, close_alert, main # type: ignore +from SekoiaXDRCloseAlert import ( + get_status_name, + get_username, + post_closure_comment, + close_alert, + main, +) # type: ignore def test_get_status_name(mocker): @@ -34,13 +39,13 @@ def test_close_alert(mocker): demisto.results.call_args[0][0]["Contents"] == "**** The alert 1 has been closed. ****" ) - + close_alert("1", "false", "reason", "notes", "admin", None, True) assert ( demisto.results.call_args[0][0]["Contents"] == "**** The alert 1 has been closed. ****" ) - + close_alert("1", "false", "reason", "notes", "admin", None, False) assert ( demisto.results.call_args[0][0]["Contents"] @@ -52,13 +57,13 @@ def test_close_alert(mocker): demisto.results.call_args[0][0]["Contents"] == "**** The alert 1 has been rejected. ****" ) - + close_alert("1", "true", "reason", "notes", "admin", None, True) assert ( demisto.results.call_args[0][0]["Contents"] == "**** The alert 1 has been rejected. ****" ) - + close_alert("1", "true", "reason", "notes", "admin", None, False) assert ( demisto.results.call_args[0][0]["Contents"]