added isInJson tests

This commit is contained in:
Semphorin
2023-12-18 11:47:25 -05:00
parent 6a4e05d60f
commit 03421c1bcd

View File

@@ -21,6 +21,36 @@ class TestMalwarebazaarMethods(unittest.TestCase):
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,