From fcd4aa84edb79d40e3616918b710b8a3a277f4a8 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 18 Feb 2011 03:24:08 +0200 Subject: s4/drs-tests: Inherit DrsDeleteObjectTestCase from DrsBaseTestCase and remove duplicated functionality --- source4/torture/drs/python/delete_object.py | 46 ++--------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) (limited to 'source4/torture/drs/python') diff --git a/source4/torture/drs/python/delete_object.py b/source4/torture/drs/python/delete_object.py index c52060f943..b652377ec7 100644 --- a/source4/torture/drs/python/delete_object.py +++ b/source4/torture/drs/python/delete_object.py @@ -37,46 +37,17 @@ from ldb import ( SCOPE_SUBTREE ) -import samba.tests +import drs_base -class DrsDeleteObjectTestCase(samba.tests.TestCase): +class DrsDeleteObjectTestCase(drs_base.DrsBaseTestCase): def setUp(self): super(DrsDeleteObjectTestCase, self).setUp() - # connect to DCs - url_dc = samba.tests.env_get_var_value("DC1") - (self.ldb_dc1, self.info_dc1) = samba.tests.connect_samdb_ex(url_dc, - ldap_only=True) - url_dc = samba.tests.env_get_var_value("DC2") - (self.ldb_dc2, self.info_dc2) = samba.tests.connect_samdb_ex(url_dc, - ldap_only=True) - - # cache some of RootDSE props - self.schema_dn = self.info_dc1["schemaNamingContext"][0] - self.domain_dn = self.info_dc1["defaultNamingContext"][0] - self.config_dn = self.info_dc1["configurationNamingContext"][0] - self.forest_level = int(self.info_dc1["forestFunctionality"][0]) - - # we will need DCs DNS names for 'samba-tool drs' command - self.dnsname_dc1 = self.info_dc1["dnsHostName"][0] - self.dnsname_dc2 = self.info_dc2["dnsHostName"][0] - def tearDown(self): super(DrsDeleteObjectTestCase, self).tearDown() - def _GUID_string(self, guid): - return self.ldb_dc1.schema_format_value("objectGUID", guid) - - def _deleted_objects_dn(self, sam_ldb): - wkdn = "" % self.domain_dn - res = sam_ldb.search(base=wkdn, - scope=SCOPE_BASE, - controls=["show_deleted:1"]) - self.assertEquals(len(res), 1) - return str(res[0]["dn"]) - def _make_username(self): return "DrsDelObjUser_" + time.strftime("%s", time.gmtime()) @@ -107,19 +78,6 @@ class DrsDeleteObjectTestCase(samba.tests.TestCase): self.assertEquals(user_orig["dn"], user_cur["dn"]) self.assertTrue(dodn not in str(user_cur["dn"])) - def _net_drs_replicate(self, DC, fromDC): - # find out where is net command - samba_tool_cmd = os.path.abspath("./bin/samba-tool") - # make command line credentials string - creds = self.get_credentials() - cmd_line_auth = "-U%s/%s%%%s" % (creds.get_domain(), - creds.get_username(), creds.get_password()) - # bin/samba-tool drs replicate - cmd_line = "%s drs replicate %s %s %s %s" % (samba_tool_cmd, DC, fromDC, - self.domain_dn, cmd_line_auth) - ret = os.system(cmd_line) - self.assertEquals(ret, 0, "Replicating %s from %s has failed!" % (DC, fromDC)) - def test_NetReplicateCmd(self): """Triggers replication from DC1 to DC2 and vice versa so both DCs are synchronized -- cgit