Skip to content

Commit

Permalink
Test Case for pre commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sudhanshu-metron committed Oct 29, 2024
1 parent 1db6001 commit f121781
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand All @@ -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")
Expand Down

0 comments on commit f121781

Please sign in to comment.