From f1217817bec40681802d4e04bf8a0152e1480157 Mon Sep 17 00:00:00 2001 From: sudhanshu-metron Date: Wed, 30 Oct 2024 00:50:10 +0530 Subject: [PATCH] Test Case for pre commit hooks --- .../Cybereason/Cybereason_test.py | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py b/Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py index b4fd6fc8b425..7c701572aee1 100644 --- a/Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py +++ b/Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py @@ -1016,12 +1016,12 @@ def test_malop_to_incident(mocker): with pytest.raises(Exception) as exc_info: command_output = malop_to_incident("args") assert exc_info.match(r"Cybereason raw response is not valid") - + def test_malop_to_incident_2(mocker): from Cybereason import malop_to_incident args = { - "guidString": "12345A", + "guidString": "12345B", "status": "UNREAD", "simpleValues": { "detectionType": { @@ -1053,23 +1053,23 @@ def test_malop_to_incident_2(mocker): } command_output = malop_to_incident(args) - assert all([(command_output['name'] == "Cybereason Malop 12345A"), (command_output['status'] == 0), + assert all([(command_output['name'] == "Cybereason Malop 12345B"), (command_output['status'] == 0), (command_output['CustomFields']['malopcreationtime'] == "1721"), (command_output['CustomFields']['malopupdatetime'] == "17280"), (command_output['CustomFields']['malopdetectiontype'] == "ABCD"), (command_output['CustomFields']['maloprootcauseelementname'] == "fileName"), (command_output['CustomFields']['maloprootcauseelementtype'] == "ABCD"), - (command_output['CustomFields']['malopedr']), (command_output['dbotmirrorid'] == "12345A")]) + (command_output['CustomFields']['malopedr']), (command_output['dbotmirrorid'] == "12345B")]) with pytest.raises(Exception) as exc_info: command_output = malop_to_incident("args") assert exc_info.match(r"Cybereason raw response is not valid") - - + + def test_malop_to_incident_3(mocker): from Cybereason import malop_to_incident args = { - "guidString": "12345A", + "guidString": "12345C", "status": "Remediated", "malopDetectionType": "ABCD", "creationTime": "23456", @@ -1078,11 +1078,34 @@ def test_malop_to_incident_3(mocker): } command_output = malop_to_incident(args) - assert all([(command_output['name'] == "Cybereason Malop 12345A"), (command_output['status'] == 1), + assert all([(command_output['name'] == "Cybereason Malop 12345C"), (command_output['status'] == 1), + (command_output['CustomFields']['malopcreationtime'] == "23456"), + (command_output['CustomFields']['malopupdatetime'] == "6789"), + (command_output['CustomFields']['malopdetectiontype'] == "ABCD"), + (not command_output['CustomFields']['malopedr']), (command_output['dbotmirrorid'] == "12345C")]) + + with pytest.raises(Exception) as exc_info: + command_output = malop_to_incident("args") + assert exc_info.match(r"Cybereason raw response is not valid") + + +def test_malop_to_incident_4(mocker): + from Cybereason import malop_to_incident + args = { + "guidString": "12345D", + "status": "RESOLVED", + "malopDetectionType": "ABCD", + "creationTime": "23456", + "lastUpdateTime": "6789", + "edr": True + } + command_output = malop_to_incident(args) + + assert all([(command_output['name'] == "Cybereason Malop 12345D"), (command_output['status'] == 2), (command_output['CustomFields']['malopcreationtime'] == "23456"), (command_output['CustomFields']['malopupdatetime'] == "6789"), (command_output['CustomFields']['malopdetectiontype'] == "ABCD"), - (not command_output['CustomFields']['malopedr']), (command_output['dbotmirrorid'] == "12345A")]) + (command_output['CustomFields']['malopedr']), (command_output['dbotmirrorid'] == "12345D")]) with pytest.raises(Exception) as exc_info: command_output = malop_to_incident("args")