s4/drs-tests: Inherit DrsFsmoTestCase from DrsBaseTestCase
authorKamen Mazdrashki <kamenim@samba.org>
Fri, 18 Feb 2011 01:25:02 +0000 (03:25 +0200)
committerKamen Mazdrashki <kamenim@samba.org>
Sun, 20 Feb 2011 21:13:09 +0000 (23:13 +0200)
and remove duplicated functionality

source4/torture/drs/python/fsmo.py

index d7b3c1671daf8ac7099aace2d91690aa87e52a51..c137c7e8e5745e08cdc7a290486ce09c47418383 100644 (file)
@@ -33,16 +33,9 @@ sys.path.insert(0, "bin/python")
 
 from ldb import SCOPE_BASE
 
-import samba.tests
+import drs_base
 
-class DrsFsmoTestCase(samba.tests.TestCase):
-
-    # RootDSE msg for DC1
-    info_dc1 = None
-    ldb_dc1 = None
-    # RootDSE msg for DC1
-    info_dc2 = None
-    ldb_dc2 = None
+class DrsFsmoTestCase(drs_base.DrsBaseTestCase):
 
     def setUp(self):
         super(DrsFsmoTestCase, self).setUp()
@@ -50,40 +43,14 @@ class DrsFsmoTestCase(samba.tests.TestCase):
         # we have to wait for the replication before we make the check
         self.fsmo_wait_max_time = 20
         self.fsmo_wait_sleep_time = 0.2
-        # connect to DCs singleton
-        if self.ldb_dc1 is None:
-            DrsFsmoTestCase.dc1 = samba.tests.env_get_var_value("DC1")
-            DrsFsmoTestCase.ldb_dc1 = samba.tests.connect_samdb(self.dc1, ldap_only=True)
-        if self.ldb_dc2 is None:
-            DrsFsmoTestCase.dc2 = samba.tests.env_get_var_value("DC2")
-            DrsFsmoTestCase.ldb_dc2 = samba.tests.connect_samdb(self.dc2, ldap_only=True)
-
-        # fetch rootDSEs
-        if self.info_dc1 is None:
-            ldb = self.ldb_dc1
-            res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
-            self.assertEquals(len(res), 1)
-            DrsFsmoTestCase.info_dc1 = res[0]
-        if self.info_dc2 is None:
-            ldb = self.ldb_dc2
-            res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
-            self.assertEquals(len(res), 1)
-            DrsFsmoTestCase.info_dc2 = res[0]
 
         # 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.dsServiceName_dc1 = self.info_dc1["dsServiceName"][0]
         self.dsServiceName_dc2 = self.info_dc2["dsServiceName"][0]
         self.infrastructure_dn = "CN=Infrastructure," + self.domain_dn
         self.naming_dn = "CN=Partitions," + self.config_dn
         self.rid_dn = "CN=RID Manager$,CN=System," + self.domain_dn
 
-        # we will need DCs DNS names for 'net fsmo' command
-        self.dnsname_dc1 = self.info_dc1["dnsHostName"][0]
-        self.dnsname_dc2 = self.info_dc2["dnsHostName"][0]
-
     def tearDown(self):
         super(DrsFsmoTestCase, self).tearDown()