2 # -*- coding: utf-8 -*-
4 # Tests various schema replication scenarios
6 # Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # export DC1=dc1_dns_name
25 # export DC2=dc2_dns_name
26 # export SUBUNITRUN=$samba4srcdir/scripting/bin/subunitrun
27 # PYTHONPATH="$PYTHONPATH:$samba4srcdir/torture/drs/python" $SUBUNITRUN replica_sync -U"$DOMAIN/$DC_USERNAME"%"$DC_PASSWORD"
48 class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
49 """Intended as a black box test case for DsReplicaSync
50 implementation. It should test the behavior of this
51 case in cases when inbound replication is disabled"""
54 super(DrsReplicaSyncTestCase, self).setUp()
57 # re-enable replication
58 self._enable_inbound_repl(self.dnsname_dc1)
59 super(DrsReplicaSyncTestCase, self).tearDown()
61 def test_ReplEnabled(self):
62 """Tests we can replicate when replication is enabled"""
63 self._enable_inbound_repl(self.dnsname_dc1)
64 self._net_drs_replicate(DC=self.dnsname_dc1, fromDC=self.dnsname_dc2, forced=False)
66 def test_ReplDisabled(self):
67 """Tests we cann't replicate when replication is disabled"""
68 self._disable_inbound_repl(self.dnsname_dc1)
70 self._net_drs_replicate(DC=self.dnsname_dc1, fromDC=self.dnsname_dc2, forced=False)
71 except samba.tests.BlackboxProcessError, e:
72 self.assertTrue('WERR_DS_DRA_SINK_DISABLED' in e.stderr)
74 self.fail("'drs replicate' command should have failed!")
76 def test_ReplDisabledForced(self):
77 """Tests we cann't replicate when replication is disabled"""
78 self._disable_inbound_repl(self.dnsname_dc1)
79 out = self._net_drs_replicate(DC=self.dnsname_dc1, fromDC=self.dnsname_dc2, forced=True)