mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 01:32:47 +01:00
added isInJson tests
This commit is contained in:
@@ -22,6 +22,36 @@ class TestMalwarebazaarMethods(unittest.TestCase):
|
|||||||
self.assertEqual(mock_cmd.getvalue(), expected)
|
self.assertEqual(mock_cmd.getvalue(), expected)
|
||||||
mock.assert_called_once()
|
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):
|
def test_analyze(self):
|
||||||
"""simulated sendReq and prepareResults with 2 mock objects and variables sendReqOutput and prepareResultOutput,
|
"""simulated sendReq and prepareResults with 2 mock objects and variables sendReqOutput and prepareResultOutput,
|
||||||
input created for analyze method call and then we compared results['summary'] with 'no result' """
|
input created for analyze method call and then we compared results['summary'] with 'no result' """
|
||||||
|
|||||||
Reference in New Issue
Block a user