1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-28 11:42:03 +03:00

samba-tool test: ensure samba-tool help works

We make sure the output is identical to `samba-tool --help` for the same
subcommands.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Dec 22 07:50:21 CET 2017 on sn-devel-144
This commit is contained in:
Douglas Bagnall
2017-12-18 17:06:07 +13:00
committed by Andrew Bartlett
parent 316594f211
commit 8a42954775

View File

@ -23,7 +23,7 @@ from samba.tests import BlackboxProcessError
class HelpTestCase(SambaToolCmdTest):
"""Tests for samba-tool --help
"""Tests for samba-tool help and --help
We test for consistency and lack of crashes."""
@ -48,12 +48,22 @@ class HelpTestCase(SambaToolCmdTest):
output = e.stdout
failed_commands.append(c)
output = output.partition('Available subcommands:')[2]
subcommands = re.findall(r'^\s*([\w-]+)\s+-', output,
tail = output.partition('Available subcommands:')[2]
subcommands = re.findall(r'^\s*([\w-]+)\s+-', tail,
re.MULTILINE)
for s in subcommands:
new_commands.append(c + [s])
# check that `samba-tool help X Y` == `samba-tool X Y --help`
line = ' '.join(['samba-tool', 'help'] + c)
try:
output2 = self.check_output(line)
except BlackboxProcessError as e:
output2 = e.stdout
failed_commands.append(c)
self.assertEqual(output, output2)
if not new_commands:
break