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."""
23 class SambaToolDrsTests(samba
.tests
.BlackboxTestCase
):
24 """Blackbox test case for samba-tool drs."""
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(),
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
44 Output should be like:
46 <list-of-supported-extensions>
49 out
= self
.check_output("samba-tool drs bind %s %s" % (self
.dc1
,
51 self
.assertTrue("Site GUID:" in out
)
52 self
.assertTrue("Repl epoch:" in out
)
54 def test_samba_tool_kcc(self
):
55 """Tests 'samba-tool drs kcc' command
56 Output should be like 'Consistency check on <DC> successful.'"""
57 out
= self
.check_output("samba-tool drs kcc %s %s" % (self
.dc1
,
59 self
.assertTrue("Consistency check on" in out
)
60 self
.assertTrue("successful" in out
)
62 def test_samba_tool_showrepl(self
):
63 """Tests 'samba-tool drs showrepl' command
64 Output should be like:
65 <site-name>/<domain-name>
66 DSA Options: <hex-options>
67 DSA object GUID: <DSA-object-GUID>
68 DSA invocationId: <DSA-invocationId>
69 <Inbound-connections-list>
70 <Outbound-connections-list>
73 TODO: Perhaps we should check at least for
74 DSA's objectGUDI and invocationId"""
75 out
= self
.check_output("samba-tool drs showrepl %s %s" % (self
.dc1
,
77 self
.assertTrue("DSA Options:" in out
)
78 self
.assertTrue("DSA object GUID:" in out
)
79 self
.assertTrue("DSA invocationId:" in out
)
81 def test_samba_tool_options(self
):
82 """Tests 'samba-tool drs options' command
83 Output should be like 'Current DSA options: IS_GC <OTHER_FLAGS>'"""
84 out
= self
.check_output("samba-tool drs options %s %s" % (self
.dc1
,
86 self
.assertTrue("Current DSA options:" in out
)
88 def test_samba_tool_replicate(self
):
89 """Tests 'samba-tool drs replicate' command
90 Output should be like 'Replicate from <DC-SRC> to <DC-DEST> was successful.'"""
91 nc_name
= self
._get
_rootDSE
(self
.dc1
)["defaultNamingContext"]
92 out
= self
.check_output("samba-tool drs replicate %s %s %s %s" % (self
.dc1
,
96 self
.assertTrue("Replicate from" in out
)
97 self
.assertTrue("was successful" in out
)