]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests: move samba-tool drs showrepl into its own suite
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 2 Feb 2018 02:59:38 +0000 (15:59 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 14 Feb 2018 23:18:29 +0000 (00:18 +0100)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/selftest/tests.py
source4/torture/drs/python/samba_tool_drs.py
source4/torture/drs/python/samba_tool_drs_showrepl.py [new file with mode: 0644]

index c64101ff46305ec521857668af61ebebba001cb4..49d1bbbd072b9b7d495293d68236aafe704cb8fa 100755 (executable)
@@ -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,
index 669f9e1e85f460fd41f2a59ffad13f43b92fa438..fcc681dc9e46daf135104fb742b877575637354d 100644 (file)
@@ -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:
-        #      <site-name>/<domain-name>
-        #      DSA Options: <hex-options>
-        #      DSA object GUID: <DSA-object-GUID>
-        #      DSA invocationId: <DSA-invocationId>
-        #      <Inbound-connections-list>
-        #      <Outbound-connections-list>
-        #      <KCC-objects>
-        #      ...
-        #   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 (file)
index 0000000..08babb2
--- /dev/null
@@ -0,0 +1,59 @@
+# Blackbox tests for "samba-tool drs" command
+# Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
+# Copyright (C) Andrew Bartlett <abartlet@samba.org> 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 <http://www.gnu.org/licenses/>.
+#
+
+"""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:
+        #      <site-name>/<domain-name>
+        #      DSA Options: <hex-options>
+        #      DSA object GUID: <DSA-object-GUID>
+        #      DSA invocationId: <DSA-invocationId>
+        #      <Inbound-connections-list>
+        #      <Outbound-connections-list>
+        #      <KCC-objects>
+        #      ...
+        #   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)