Skip to content

Commit 1965007

Browse files
Add unit test for path issues
1 parent 7bd4787 commit 1965007

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

detection_rules/etc/test_toml.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
]
4949
}
5050
},
51+
{
52+
"metadata": {
53+
"field": "value"
54+
},
55+
"rule": {
56+
"path": "?:\\\\Windows\\\\Sys?????\\\\x5lrs.dll"
57+
}
58+
},
5159
{
5260
"metadata": {
5361
"field": "value"

tests/test_toml_formatter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,12 @@ def test_formatter_rule(self):
7171

7272
def test_formatter_deep(self):
7373
"""Test that the data remains unchanged from formatting."""
74-
self.compare_test_data(self.test_data[1:])
74+
self.compare_test_data(self.test_data[2:])
75+
76+
def test_formatter_paths(self):
77+
"""Test that paths are handled as expected in with toml lib."""
78+
with self.assertRaisesRegex(
79+
AssertionError,
80+
r'\+ {"metadata": {"field": "value"}, "rule": {"path": "\?:\\\\Windows\\\\Sys\?\?\?\?\?\\\\x5lrs\.dll"}}',
81+
):
82+
self.compare_test_data([self.test_data[1]])

0 commit comments

Comments
 (0)