1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-16 00:23:52 +03:00

samba-tool:testparm: Test error handling for unknown sections and parameters

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14143

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton
2021-04-29 20:23:21 +12:00
committed by Andrew Bartlett
parent e54563861b
commit 11f26877ce
2 changed files with 30 additions and 0 deletions

View File

@@ -94,6 +94,34 @@ class TestParmTests(NetCmdTestCase):
"--section-name=tmp"],
retcode=None)
def test_no_such_section(self):
out, err = self.run_netcmd(cmd_testparm,
["--configfile=%s" % self.smbconf.name,
"--section-name=foo"],
retcode=-1)
# Ensure all exceptions are caught.
self.assertEqual("", out)
self.assertNotIn("uncaught exception", err)
out, err = self.run_netcmd(cmd_testparm,
["--configfile=%s" % self.smbconf.name,
"--section-name=foo",
"--parameter-name=foo"],
retcode=-1)
# Ensure all exceptions are caught.
self.assertEqual("", out)
self.assertNotIn("uncaught exception", err)
def test_no_such_parameter(self):
out, err = self.run_netcmd(cmd_testparm,
["--configfile=%s" % self.smbconf.name,
"--section-name=tmp",
"--parameter-name=foo"],
retcode=-1)
# Ensure all exceptions are caught.
self.assertEqual("", out)
self.assertNotIn("uncaught exception", err)
class CommandTests(NetCmdTestCase):