From: Douglas Bagnall Date: Fri, 2 Feb 2018 02:59:38 +0000 (+1300) Subject: tests: move samba-tool drs showrepl into its own suite X-Git-Tag: tevent-0.9.36~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cec3646c5d2ac47df129f16f8994c332e2ad06c3;p=thirdparty%2Fsamba.git tests: move samba-tool drs showrepl into its own suite This is a simple copy of the sowrepl test to the new file, making room to expand the test and (soon) to test JSON output. pep-8 intentionally ignored to show this is a copy. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index c64101ff463..49d1bbbd072 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -859,6 +859,11 @@ for env in ['vampire_dc', 'promoted_dc']: name="samba4.drs.samba_tool_drs.python(%s)" % env, environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) + planoldpythontestsuite("%s:local" % env, "samba_tool_drs_showrepl", + extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')], + name="samba4.drs.samba_tool_drs_showrepl.python(%s)" % env, + environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()}, + extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) planoldpythontestsuite("%s:local" % env, "replica_sync", extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')], name="samba4.drs.replica_sync.python(%s)" % env, diff --git a/source4/torture/drs/python/samba_tool_drs.py b/source4/torture/drs/python/samba_tool_drs.py index 669f9e1e85f..fcc681dc9e4 100644 --- a/source4/torture/drs/python/samba_tool_drs.py +++ b/source4/torture/drs/python/samba_tool_drs.py @@ -80,26 +80,6 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase): self.assertTrue("Consistency check on" in out) self.assertTrue("successful" in out) - def test_samba_tool_showrepl(self): - """Tests 'samba-tool drs showrepl' command. - """ - # Output should be like: - # / - # DSA Options: - # DSA object GUID: - # DSA invocationId: - # - # - # - # ... - # TODO: Perhaps we should check at least for - # DSA's objectGUDI and invocationId - out = self.check_output("samba-tool drs showrepl %s %s" % (self.dc1, - self.cmdline_creds)) - self.assertTrue("DSA Options:" in out) - self.assertTrue("DSA object GUID:" in out) - self.assertTrue("DSA invocationId:" in out) - def test_samba_tool_options(self): """Tests 'samba-tool drs options' command """ diff --git a/source4/torture/drs/python/samba_tool_drs_showrepl.py b/source4/torture/drs/python/samba_tool_drs_showrepl.py new file mode 100644 index 00000000000..08babb200a9 --- /dev/null +++ b/source4/torture/drs/python/samba_tool_drs_showrepl.py @@ -0,0 +1,59 @@ +# Blackbox tests for "samba-tool drs" command +# Copyright (C) Kamen Mazdrashki 2011 +# Copyright (C) Andrew Bartlett 2017 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +"""Blackbox tests for samba-tool drs showrepl.""" +from __future__ import print_function +import samba.tests +import shutil +import os +import ldb +import drs_base + +class SambaToolDrsShowReplTests(drs_base.DrsBaseTestCase): + """Blackbox test case for samba-tool drs.""" + + def setUp(self): + super(SambaToolDrsShowReplTests, self).setUp() + + self.dc1 = samba.tests.env_get_var_value("DC1") + self.dc2 = samba.tests.env_get_var_value("DC2") + + creds = self.get_credentials() + self.cmdline_creds = "-U%s/%s%%%s" % (creds.get_domain(), + creds.get_username(), creds.get_password()) + + def test_samba_tool_showrepl(self): + """Tests 'samba-tool drs showrepl' command. + """ + # Output should be like: + # / + # DSA Options: + # DSA object GUID: + # DSA invocationId: + # + # + # + # ... + # TODO: Perhaps we should check at least for + # DSA's objectGUDI and invocationId + out = self.check_output("samba-tool drs showrepl %s %s" % (self.dc1, + self.cmdline_creds)) + + self.assertTrue("DSA Options:" in out) + self.assertTrue("DSA object GUID:" in out) + self.assertTrue("DSA invocationId:" in out)