Skip to content

Commit

Permalink
added isInJson tests
Browse files Browse the repository at this point in the history
  • Loading branch information
semphorin committed Dec 18, 2023
1 parent 6a4e05d commit 50becb6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions salt/sensoroni/files/analyzers/malwarebazaar/malwarebazaar_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,36 @@ def test_main_success(self):
expected = '{"test": "val"}\n'
self.assertEqual(mock_cmd.getvalue(), expected)
mock.assert_called_once()

def isInJson_string_found_in_dict(self):
test_string = "helo"
input_json = {
"value":"test",
"test":"value",
"arr":["Foo", "Bar", "Hello"],
"dict1":{"helo":"val", "key":"val"}
}
self.assertEqual(malwarebazaar.isInJson(test_string), True)

def isInJson_string_found_in_arr(self):
test_string = "helo"
input_json = {
"value":"test",
"test":"value",
"arr":["Foo", "Bar", "helo"],
"dict1":{"Hello":"val", "key":"val"}
}
self.assertEqual(malwarebazaar.isInJson(test_string), True)

def isInJson_string_not_found(self):
test_string = "ValNotInJSON"
input_json = {
"value":"test",
"test":"value",
"arr":["Foo", "Bar", "helo"],
"dict1":{"Hello":"val", "key":"val"}
}
self.assertEqual(malwarebazaar.isInJson(test_string), False)

def test_analyze(self):
"""simulated sendReq and prepareResults with 2 mock objects and variables sendReqOutput and prepareResultOutput,
Expand Down

0 comments on commit 50becb6

Please sign in to comment.