1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

pytest samba-tool forest: use runcmd

This is an example/test to show how runsublevelcmd() converts into
runcmd() whilst ensuring it works.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2022-09-07 22:17:41 +12:00 committed by Andrew Bartlett
parent 098886946f
commit b501363417

View File

@ -43,11 +43,12 @@ class ForestCmdTestCase(SambaToolCmdTest):
def test_display(self):
"""Tests that we can display forest settings"""
(result, out, err) = self.runsublevelcmd("forest", ("directory_service",
"show"),
"-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"],
os.environ["DC_PASSWORD"]))
(result, out, err) = self.runcmd("forest",
"directory_service",
"show",
"-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"],
os.environ["DC_PASSWORD"]))
self.assertCmdSuccess(result, out, err)
self.assertEqual(err, "", "Shouldn't be any error messages")
@ -56,11 +57,13 @@ class ForestCmdTestCase(SambaToolCmdTest):
def test_modify_dsheuristics(self):
"""Test that we can modify the dsheuristics setting"""
(result, out, err) = self.runsublevelcmd("forest", ("directory_service",
"dsheuristics"), "0000002",
"-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"],
os.environ["DC_PASSWORD"]))
(result, out, err) = self.runcmd("forest",
"directory_service",
"dsheuristics",
"0000002",
"-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"],
os.environ["DC_PASSWORD"]))
self.assertCmdSuccess(result, out, err)
self.assertEqual(err, "", "Shouldn't be any error messages")