mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Update tests to account for change in 'file_path' value verification
This commit is contained in:
@@ -28,22 +28,6 @@ class TestLocalfileMethods(unittest.TestCase):
|
|||||||
mock.assert_called_once()
|
mock.assert_called_once()
|
||||||
lcmock.assert_called_once()
|
lcmock.assert_called_once()
|
||||||
|
|
||||||
def test_checkConfigRequirements_present(self):
|
|
||||||
conf = {"file_path": "['intel.csv']"}
|
|
||||||
self.assertTrue(localfile.checkConfigRequirements(conf))
|
|
||||||
|
|
||||||
def test_checkConfigRequirements_not_present(self):
|
|
||||||
conf = {"not_a_file_path": "blahblah"}
|
|
||||||
with self.assertRaises(SystemExit) as cm:
|
|
||||||
localfile.checkConfigRequirements(conf)
|
|
||||||
self.assertEqual(cm.exception.code, 126)
|
|
||||||
|
|
||||||
def test_checkConfigRequirements_empty(self):
|
|
||||||
conf = {"file_path": ""}
|
|
||||||
with self.assertRaises(SystemExit) as cm:
|
|
||||||
localfile.checkConfigRequirements(conf)
|
|
||||||
self.assertEqual(cm.exception.code, 126)
|
|
||||||
|
|
||||||
def test_searchFile_multiple_found(self):
|
def test_searchFile_multiple_found(self):
|
||||||
artifact = "abcd1234"
|
artifact = "abcd1234"
|
||||||
results = localfile.searchFile(artifact, ["localfile_test.csv"])
|
results = localfile.searchFile(artifact, ["localfile_test.csv"])
|
||||||
@@ -115,7 +99,7 @@ class TestLocalfileMethods(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
artifactInput = '{"value":"foo","artifactType":"url"}'
|
artifactInput = '{"value":"foo","artifactType":"url"}'
|
||||||
conf = {"file_path": "/home/intel.csv"}
|
conf = {"file_path": ['/home/intel.csv']}
|
||||||
with patch('localfile.localfile.searchFile', new=MagicMock(return_value=output)) as mock:
|
with patch('localfile.localfile.searchFile', new=MagicMock(return_value=output)) as mock:
|
||||||
results = localfile.analyze(conf, artifactInput)
|
results = localfile.analyze(conf, artifactInput)
|
||||||
self.assertEqual(results["summary"], "suspicious")
|
self.assertEqual(results["summary"], "suspicious")
|
||||||
|
|||||||
Reference in New Issue
Block a user