Skip to content

Commit 352f6ba

Browse files
committed
Added some tests for syslog path checking
1 parent d5db585 commit 352f6ba

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from salt.utils.validate import path
2+
from tests.support.unit import TestCase
3+
4+
5+
class ValidatePathTestCase(TestCase):
6+
"""
7+
TestCase for salt.utils.validate.path module
8+
"""
9+
10+
def test_is_syslog_path(self):
11+
12+
"""
13+
Test syslog path
14+
"""
15+
16+
valid_paths = [
17+
"file:///dev/log",
18+
"file:///dev/log/LOG_USER",
19+
"udp://loghost:10514",
20+
"udp://loghost:10514/LOG_USER",
21+
"udp://loghost/LOG_USER",
22+
"tcp://loghost:10514",
23+
"tcp://loghost:10514/LOG_USER",
24+
"tcp://loghost/USER"
25+
]
26+
27+
invalid_paths = [
28+
"/dev/log",
29+
"file:///dev/log/USER",
30+
"udp://loghost/USER",
31+
"tcp://loghost/USER",
32+
"unix:///dev/log"
33+
]
34+
35+
for addr in valid_paths:
36+
self.assertTrue(path.is_syslog_path(addr))
37+
38+
for addr in invalid_paths:
39+
self.assertFalse(path.is_syslog_path(addr))

0 commit comments

Comments
 (0)