mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 01:32:47 +01:00
uopdate error message
This commit is contained in:
@@ -45,7 +45,7 @@ def appendItem(content, key, listItem):
|
|||||||
try:
|
try:
|
||||||
content[key].append(listItem)
|
content[key].append(listItem)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
print("The key provided is not a list. No action was taken on the file.")
|
print("The existing value for the given key is not a list. No action was taken on the file.")
|
||||||
return 1
|
return 1
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("The key provided does not exist. No action was taken on the file.")
|
print("The key provided does not exist. No action was taken on the file.")
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class TestRemove(unittest.TestCase):
|
|||||||
sys.argv = ["cmd", "append", filename, "key1", "h"]
|
sys.argv = ["cmd", "append", filename, "key1", "h"]
|
||||||
soyaml.main()
|
soyaml.main()
|
||||||
sysmock.assert_called()
|
sysmock.assert_called()
|
||||||
self.assertEqual(mock_stdout.getvalue(), "The key provided is not a list. No action was taken on the file.\n")
|
self.assertEqual(mock_stdout.getvalue(), "The existing value for the given key is not a list. No action was taken on the file.\n")
|
||||||
|
|
||||||
def test_append_key_nonlist_deep(self):
|
def test_append_key_nonlist_deep(self):
|
||||||
filename = "/tmp/so-yaml_test-append.yaml"
|
filename = "/tmp/so-yaml_test-append.yaml"
|
||||||
@@ -200,4 +200,4 @@ class TestRemove(unittest.TestCase):
|
|||||||
sys.argv = ["cmd", "append", filename, "key1.child2.deep1", "h"]
|
sys.argv = ["cmd", "append", filename, "key1.child2.deep1", "h"]
|
||||||
soyaml.main()
|
soyaml.main()
|
||||||
sysmock.assert_called()
|
sysmock.assert_called()
|
||||||
self.assertEqual(mock_stdout.getvalue(), "The key provided is not a list. No action was taken on the file.\n")
|
self.assertEqual(mock_stdout.getvalue(), "The existing value for the given key is not a list. No action was taken on the file.\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user