diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-07-24 16:58:57 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-07-24 16:58:57 -0400 |
commit | 6970029c661ab858a55dd467e5c593694ab39512 (patch) | |
tree | c2397e8d6a619157709fd50dea6b0dd22b48571f /tests/unittests | |
parent | 17e055018349c1813dffb04b0434b18c94dd7d3d (diff) | |
download | vyos-cloud-init-6970029c661ab858a55dd467e5c593694ab39512.tar.gz vyos-cloud-init-6970029c661ab858a55dd467e5c593694ab39512.zip |
commit initial re-work/re-implementation of syslog config
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_handler/test_handler_syslog.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_syslog.py b/tests/unittests/test_handler/test_handler_syslog.py new file mode 100644 index 00000000..bbfd521e --- /dev/null +++ b/tests/unittests/test_handler/test_handler_syslog.py @@ -0,0 +1,32 @@ +from cloudinit.config.cc_syslog import ( + parse_remotes_line, SyslogRemotesLine, remotes_to_rsyslog_cfg) +from cloudinit import util +from .. import helpers as t_help + + +class TestParseRemotesLine(t_help.TestCase): + def test_valid_port(self): + r = parse_remotes_line("foo:9") + self.assertEqual(9, r.port) + + def test_invalid_port(self): + with self.assertRaises(ValueError): + parse_remotes_line("*.* foo:abc") + + def test_valid_ipv6(self): + r = parse_remotes_line("*.* [::1]") + self.assertEqual("*.* [::1]", str(r)) + + def test_valid_ipv6_with_port(self): + r = parse_remotes_line("*.* [::1]:100") + self.assertEqual(r.port, 100) + self.assertEqual(r.addr, "::1") + self.assertEqual("*.* [::1]:100", str(r)) + + def test_invalid_multiple_colon(self): + with self.assertRaises(ValueError): + parse_remotes_line("*.* ::1:100") + + def test_name_in_string(self): + r = parse_remotes_line("syslog.host", name="foobar") + self.assertEqual("*.* syslog.host # foobar", str(r)) |