1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

pytest/samba-tool visualize: test '--color' aliases

By convention, 'tty' is a common alias for 'auto', 'always' and
'force' mean 'yes', and 'never' means no. It seems 'never; and
'always' are more common than 'yes' and 'no'.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Douglas Bagnall 2022-08-17 11:50:55 +12:00 committed by Douglas Bagnall
parent 6160e956b5
commit 664653b8d1
2 changed files with 20 additions and 5 deletions

View File

@ -170,13 +170,27 @@ class SambaToolVisualizeLdif(SambaToolCmdTest):
# NO_COLOR='no': we still expect no colour
['no', '--color=auto', False],
# NO_COLOR=' ', alias for 'auto'
[' ', '--color=tty', False],
# NO_COLOR=' ', alias for 'auto'
[' ', '--color=if-tty', False],
# NO_COLOR='', alias for 'auto'
['', '--color=tty', True],
# NO_COLOR='', alias for 'no'
['', '--color=never', False],
# NO_COLOR='x', alias for 'yes' (--color=yes wins)
['x', '--color=force', True],
]:
os.environ['NO_COLOR'] = env
print(f" {env}, {opt}, {is_colour}")
result, out, err = self.runsubcmd("visualize", "ntdsconn",
'-H', self.dburl,
'-S',
opt)
try:
result, out, err = self.runsubcmd("visualize", "ntdsconn",
'-H', self.dburl,
'-S',
opt)
except SystemExit as e:
# optparse makes us do this
self.fail(f"optparse rejects {env}, {opt}, {is_colour}")
self.assertCmdSuccess(result, out, err)
self.assert_colour(out, is_colour, monochrome)

View File

@ -0,0 +1 @@
samba.tests.samba_tool.visualize.samba.tests.samba_tool.visualize.SambaToolVisualizeLdif.test_colour_auto_tty