mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Update Malwarebazaar test and comply with flake8
This commit is contained in:
@@ -23,6 +23,18 @@ 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 test_isInJson_tail_greater_than_max_depth(self):
|
||||||
|
max_depth = 1000
|
||||||
|
tail = 2000
|
||||||
|
test_string = "helo"
|
||||||
|
input_json = {
|
||||||
|
"value": "test",
|
||||||
|
"test": "value",
|
||||||
|
"arr": ["Foo", "Bar", "Hello"],
|
||||||
|
"dict1": {"key1": "val", "key2": "helo"}
|
||||||
|
}
|
||||||
|
self.assertEqual(malwarebazaar.isInJson(input_json, test_string, max_depth, tail), False)
|
||||||
|
|
||||||
def test_isInJson_string_found_in_dict(self):
|
def test_isInJson_string_found_in_dict(self):
|
||||||
test_string = "helo"
|
test_string = "helo"
|
||||||
input_json = {
|
input_json = {
|
||||||
@@ -33,6 +45,18 @@ class TestMalwarebazaarMethods(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
self.assertEqual(malwarebazaar.isInJson(input_json, test_string), True)
|
self.assertEqual(malwarebazaar.isInJson(input_json, test_string), True)
|
||||||
|
|
||||||
|
def test_isInJson_dict_in_list(self):
|
||||||
|
max_depth = 1000
|
||||||
|
tail = 1
|
||||||
|
test_string = "helo"
|
||||||
|
input_json = {
|
||||||
|
"key1": "test",
|
||||||
|
"key2": "value",
|
||||||
|
"key3": ["Foo", "Bar", "Hello"],
|
||||||
|
"nested_list": [{"key1": "val", "key2": "helo"}]
|
||||||
|
}
|
||||||
|
self.assertEqual(malwarebazaar.isInJson(input_json, test_string, max_depth, tail), True)
|
||||||
|
|
||||||
def test_isInJson_string_found_in_arr(self):
|
def test_isInJson_string_found_in_arr(self):
|
||||||
test_string = "helo"
|
test_string = "helo"
|
||||||
input_json = {
|
input_json = {
|
||||||
@@ -51,8 +75,7 @@ class TestMalwarebazaarMethods(unittest.TestCase):
|
|||||||
"arr": ["Foo", "Bar", "helo"],
|
"arr": ["Foo", "Bar", "helo"],
|
||||||
"dict1": {"Hello": "val", "key": "val"}
|
"dict1": {"Hello": "val", "key": "val"}
|
||||||
}
|
}
|
||||||
self.assertEqual(malwarebazaar.isInJson(
|
self.assertEqual(malwarebazaar.isInJson(input_json, test_string), False)
|
||||||
input_json, test_string), False)
|
|
||||||
|
|
||||||
def test_analyze(self):
|
def test_analyze(self):
|
||||||
"""simulated sendReq and prepareResults with 2 mock objects
|
"""simulated sendReq and prepareResults with 2 mock objects
|
||||||
|
|||||||
Reference in New Issue
Block a user