[PATCH] python tests: allow blackbox subcommands without a shell
Andrew Bartlett
abartlet at samba.org
Thu Nov 1 05:30:40 UTC 2018
On Thu, 2018-11-01 at 16:34 +1300, Douglas Bagnall via samba-technical
wrote:
> Often I have longed to start a python black-box test without using a
> subshell, but BlackboxTestCase doesn't allow such things.
>
> https://gitlab.com/samba-team/samba/merge_requests/96 (attached)
> fixes
> that. As always, a test can go:
>
> out = self.check_output("samba_dnsupdate --verbose")
>
> but now it can also go:
>
> out = self.check_output(["samba_dnsupdate", "--verbose"])
>
> which will do the same thing without a shell. Why bother? In that
> case
> it makes no difference (apart from perhaps saving milliseconds and/or
> kilobytes), but when it comes to this:
>
> password = "3(nqx$|><' #!"
> creds = "-UAdministrator%" + password
> out = self.check_output(["samba-tool",
> "drs",
> "bind",
> self.dc1,
> creds])
>
> you don't want to have to think about what the shell would make of
> that
> password.
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Pushed to autobuild.
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Catalyst IT http://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list