diff options
| author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2022-08-17 11:50:55 +1200 |
|---|---|---|
| committer | Douglas Bagnall <dbagnall@samba.org> | 2022-09-06 21:12:36 +0000 |
| commit | 664653b8d14cbe21c954d248b2bb5ef0d2d60043 (patch) | |
| tree | 05a94e19e312a75dd2bac2c9a7bba862b8004122 /python/samba | |
| parent | 6160e956b5931a2cbeb98e042c2fe71981115ba0 (diff) | |
| download | samba-664653b8d14cbe21c954d248b2bb5ef0d2d60043.tar.gz samba-664653b8d14cbe21c954d248b2bb5ef0d2d60043.tar.bz2 samba-664653b8d14cbe21c954d248b2bb5ef0d2d60043.zip | |
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>
Diffstat (limited to 'python/samba')
| -rw-r--r-- | python/samba/tests/samba_tool/visualize.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/python/samba/tests/samba_tool/visualize.py b/python/samba/tests/samba_tool/visualize.py index b4385d0b716..f4323725b75 100644 --- a/python/samba/tests/samba_tool/visualize.py +++ b/python/samba/tests/samba_tool/visualize.py @@ -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) |
