summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2011-01-22 03:22:48 +0200
committerKamen Mazdrashki <kamenim@samba.org>2011-01-25 21:30:19 +0100
commit6e2263749ab108baf7543a651123041427af96db (patch)
treef2f32f1545c127cd09a867417ff4065510b378aa
parent932911e1e1c09caa51a5c7a574987cab6ecb16e4 (diff)
downloadsamba-6e2263749ab108baf7543a651123041427af96db.tar.gz
samba-6e2263749ab108baf7543a651123041427af96db.tar.bz2
samba-6e2263749ab108baf7543a651123041427af96db.zip
s4-test/delete_object: Remove global ldb connections
Make it more xUnit compliant Autobuild-User: Kamen Mazdrashki <kamenim@samba.org> Autobuild-Date: Tue Jan 25 21:30:19 CET 2011 on sn-devel-104
-rw-r--r--source4/torture/drs/python/delete_object.py33
1 files changed, 7 insertions, 26 deletions
diff --git a/source4/torture/drs/python/delete_object.py b/source4/torture/drs/python/delete_object.py
index 0693898a28..ccc412e171 100644
--- a/source4/torture/drs/python/delete_object.py
+++ b/source4/torture/drs/python/delete_object.py
@@ -42,35 +42,16 @@ import samba.tests
class DrsDeleteObjectTestCase(samba.tests.TestCase):
- # RootDSE msg for DC1
- info_dc1 = None
- ldb_dc1 = None
- # RootDSE msg for DC1
- info_dc2 = None
- ldb_dc2 = None
-
def setUp(self):
super(DrsDeleteObjectTestCase, self).setUp()
- # connect to DCs singleton
- if self.ldb_dc1 is None:
- DrsDeleteObjectTestCase.dc1 = samba.tests.env_get_var_value("DC1")
- DrsDeleteObjectTestCase.ldb_dc1 = samba.tests.connect_samdb(self.dc1, ldap_only=True)
- if self.ldb_dc2 is None:
- DrsDeleteObjectTestCase.dc2 = samba.tests.env_get_var_value("DC2")
- DrsDeleteObjectTestCase.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)
- DrsDeleteObjectTestCase.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)
- DrsDeleteObjectTestCase.info_dc2 = res[0]
+ # 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]