summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-19 09:07:53 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-19 12:07:06 +0100
commit8b7f23d644f2c9a0e5eeffeb2f93786c54a43afe (patch)
tree728273e656926ae18cc5a3da4cdae1cb411fa81b /source4/dsdb
parent5855194894535c57797a0475640e50c07ed92643 (diff)
downloadsamba-8b7f23d644f2c9a0e5eeffeb2f93786c54a43afe.tar.gz
samba-8b7f23d644f2c9a0e5eeffeb2f93786c54a43afe.tar.bz2
samba-8b7f23d644f2c9a0e5eeffeb2f93786c54a43afe.zip
s4:dsdb tests - use even more already defined pyldb functions to retrieve NCs
Diffstat (limited to 'source4/dsdb')
-rwxr-xr-xsource4/dsdb/tests/python/deletetest.py8
-rwxr-xr-xsource4/dsdb/tests/python/ldap.py14
-rwxr-xr-xsource4/dsdb/tests/python/ldap_schema.py7
-rw-r--r--source4/dsdb/tests/python/ldap_syntaxes.py7
-rwxr-xr-xsource4/dsdb/tests/python/passwords.py11
5 files changed, 8 insertions, 39 deletions
diff --git a/source4/dsdb/tests/python/deletetest.py b/source4/dsdb/tests/python/deletetest.py
index 7582d4bef7..aec6b8c2e8 100755
--- a/source4/dsdb/tests/python/deletetest.py
+++ b/source4/dsdb/tests/python/deletetest.py
@@ -50,16 +50,10 @@ class BasicDeleteTests(unittest.TestCase):
def GUID_string(self, guid):
return self.ldb.schema_format_value("objectGUID", guid)
- def find_configurationdn(self, ldb):
- res = ldb.search(base="", expression="", scope=SCOPE_BASE,
- attrs=["configurationNamingContext"])
- self.assertEquals(len(res), 1)
- return res[0]["configurationNamingContext"][0]
-
def setUp(self):
self.ldb = ldb
self.base_dn = ldb.domain_dn()
- self.configuration_dn = self.find_configurationdn(ldb)
+ self.configuration_dn = ldb.get_config_basedn().get_linearized()
def search_guid(self, guid):
print "SEARCH by GUID %s" % self.GUID_string(guid)
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index fb191c623a..d9a4f2a6b1 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -67,16 +67,6 @@ class BasicTests(unittest.TestCase):
except LdbError, (num, _):
self.assertEquals(num, ERR_NO_SUCH_OBJECT)
- def find_configurationdn(self, ldb):
- res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["configurationNamingContext"])
- self.assertEquals(len(res), 1)
- return res[0]["configurationNamingContext"][0]
-
- def find_schemadn(self, ldb):
- res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
- self.assertEquals(len(res), 1)
- return res[0]["schemaNamingContext"][0]
-
def find_domain_sid(self):
res = self.ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE)
return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
@@ -97,8 +87,8 @@ class BasicTests(unittest.TestCase):
self.ldb = ldb
self.gc_ldb = gc_ldb
self.base_dn = ldb.domain_dn()
- self.configuration_dn = self.find_configurationdn(ldb)
- self.schema_dn = self.find_schemadn(ldb)
+ self.configuration_dn = ldb.get_config_basedn().get_linearized()
+ self.schema_dn = ldb.get_schema_basedn().get_linearized()
self.domain_sid = self.find_domain_sid()
print "baseDN: %s\n" % self.base_dn
diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py
index 168cea39d3..bc7069e999 100755
--- a/source4/dsdb/tests/python/ldap_schema.py
+++ b/source4/dsdb/tests/python/ldap_schema.py
@@ -55,16 +55,11 @@ class SchemaTests(unittest.TestCase):
except LdbError, (num, _):
self.assertEquals(num, ERR_NO_SUCH_OBJECT)
- def find_schemadn(self, ldb):
- res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
- self.assertEquals(len(res), 1)
- return res[0]["schemaNamingContext"][0]
-
def setUp(self):
super(SchemaTests, self).setUp()
self.ldb = ldb
self.base_dn = ldb.domain_dn()
- self.schema_dn = self.find_schemadn(ldb)
+ self.schema_dn = ldb.get_schema_basedn().get_linearized()
def test_generated_schema(self):
"""Testing we can read the generated schema via LDAP"""
diff --git a/source4/dsdb/tests/python/ldap_syntaxes.py b/source4/dsdb/tests/python/ldap_syntaxes.py
index c1dd4d546e..6381657ae3 100644
--- a/source4/dsdb/tests/python/ldap_syntaxes.py
+++ b/source4/dsdb/tests/python/ldap_syntaxes.py
@@ -56,11 +56,6 @@ class SyntaxTests(unittest.TestCase):
except LdbError, (num, _):
self.assertEquals(num, ERR_NO_SUCH_OBJECT)
- def find_schemadn(self, ldb):
- res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
- self.assertEquals(len(res), 1)
- return res[0]["schemaNamingContext"][0]
-
def _find_domain_sid(self):
res = self.ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE)
return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
@@ -69,7 +64,7 @@ class SyntaxTests(unittest.TestCase):
super(SyntaxTests, self).setUp()
self.ldb = ldb
self.base_dn = ldb.domain_dn()
- self.schema_dn = self.find_schemadn(ldb)
+ self.schema_dn = ldb.get_schema_basedn().get_linearized()
self._setup_dn_string_test()
self._setup_dn_binary_test()
self.domain_sid = self._find_domain_sid()
diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py
index f238c1adc4..461d135003 100755
--- a/source4/dsdb/tests/python/passwords.py
+++ b/source4/dsdb/tests/python/passwords.py
@@ -926,15 +926,10 @@ if not "://" in host:
ldb = SamDB(url=host, session_info=system_session(), credentials=creds, lp=lp)
-# Gets back the configuration basedn
-res = ldb.search(base="", expression="", scope=SCOPE_BASE,
- attrs=["configurationNamingContext"])
-configuration_dn = res[0]["configurationNamingContext"][0]
-
# Gets back the basedn
-res = ldb.search(base="", expression="", scope=SCOPE_BASE,
- attrs=["defaultNamingContext"])
-base_dn = res[0]["defaultNamingContext"][0]
+base_dn = ldb.domain_dn()
+# Gets back the configuration basedn
+configuration_dn = ldb.get_config_basedn().get_linearized()
# Get the old "dSHeuristics" if it was set
res = ldb.search("CN=Directory Service, CN=Windows NT, CN=Services, "