s4:gensec/gssapi: use gensec_gssapi_max_{input,wrapped}_size() for all backends
[Samba.git] / python / samba / tests / blackbox / samba_tool_drs.py
blob9b7106ff03f702dd3ec3e51223973edd4fa7468a
1 # Blackbox tests for "samba-tool drs" command
2 # Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 """Blackbox tests for samba-tool drs."""
20 import samba.tests
23 class SambaToolDrsTests(samba.tests.BlackboxTestCase):
24 """Blackbox test case for samba-tool drs."""
26 def setUp(self):
27 super(SambaToolDrsTests, self).setUp()
29 self.dc1 = samba.tests.env_get_var_value("DC1")
30 self.dc2 = samba.tests.env_get_var_value("DC2")
32 creds = self.get_credentials()
33 self.cmdline_creds = "-U%s/%s%%%s" % (creds.get_domain(),
34 creds.get_username(), creds.get_password())
36 def _get_rootDSE(self, dc):
37 samdb = samba.tests.connect_samdb(dc, lp=self.get_loadparm(),
38 credentials=self.get_credentials(),
39 ldap_only=True)
40 return samdb.search(base="", scope=samba.tests.ldb.SCOPE_BASE)[0]
42 def test_samba_tool_bind(self):
43 """Tests 'samba-tool drs bind' command."""
45 # Output should be like:
46 # Extensions supported:
47 # <list-of-supported-extensions>
48 # Site GUID: <GUID>
49 # Repl epoch: 0
50 out = self.check_output("samba-tool drs bind %s %s" % (self.dc1,
51 self.cmdline_creds))
52 self.assertTrue("Site GUID:" in out)
53 self.assertTrue("Repl epoch:" in out)
55 def test_samba_tool_kcc(self):
56 """Tests 'samba-tool drs kcc' command."""
58 # Output should be like 'Consistency check on <DC> successful.'
59 out = self.check_output("samba-tool drs kcc %s %s" % (self.dc1,
60 self.cmdline_creds))
61 self.assertTrue("Consistency check on" in out)
62 self.assertTrue("successful" in out)
64 def test_samba_tool_showrepl(self):
65 """Tests 'samba-tool drs showrepl' command.
66 """
67 # Output should be like:
68 # <site-name>/<domain-name>
69 # DSA Options: <hex-options>
70 # DSA object GUID: <DSA-object-GUID>
71 # DSA invocationId: <DSA-invocationId>
72 # <Inbound-connections-list>
73 # <Outbound-connections-list>
74 # <KCC-objects>
75 # ...
76 # TODO: Perhaps we should check at least for
77 # DSA's objectGUDI and invocationId
78 out = self.check_output("samba-tool drs showrepl %s %s" % (self.dc1,
79 self.cmdline_creds))
80 self.assertTrue("DSA Options:" in out)
81 self.assertTrue("DSA object GUID:" in out)
82 self.assertTrue("DSA invocationId:" in out)
84 def test_samba_tool_options(self):
85 """Tests 'samba-tool drs options' command
86 """
87 # Output should be like 'Current DSA options: IS_GC <OTHER_FLAGS>'
88 out = self.check_output("samba-tool drs options %s %s" % (self.dc1,
89 self.cmdline_creds))
90 self.assertTrue("Current DSA options:" in out)
92 def test_samba_tool_replicate(self):
93 """Tests 'samba-tool drs replicate' command."""
95 # Output should be like 'Replicate from <DC-SRC> to <DC-DEST> was successful.'
96 nc_name = self._get_rootDSE(self.dc1)["defaultNamingContext"]
97 out = self.check_output("samba-tool drs replicate %s %s %s %s" % (self.dc1,
98 self.dc2,
99 nc_name,
100 self.cmdline_creds))
101 self.assertTrue("Replicate from" in out)
102 self.assertTrue("was successful" in out)