summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadezhda Ivanova <nivanova@samba.org>2010-11-23 11:22:10 +0200
committerNadezhda Ivanova <nivanova@samba.org>2010-11-23 11:08:36 +0100
commit439ff8717d41fb641f2a2cf2b14665edf375433d (patch)
treea6457c83ae7b5851093b5d969b7a441a004dc5be
parentc252dac1b3263361ddac87e782c2230679f22589 (diff)
downloadsamba-439ff8717d41fb641f2a2cf2b14665edf375433d.tar.gz
samba-439ff8717d41fb641f2a2cf2b14665edf375433d.tar.bz2
samba-439ff8717d41fb641f2a2cf2b14665edf375433d.zip
s4-tests: Ldap tests now use the get_dsheuristics and set_dsheuristics from SamDB.
Autobuild-User: Nadezhda Ivanova <nivanova@samba.org> Autobuild-Date: Tue Nov 23 11:08:37 CET 2010 on sn-devel-104
-rwxr-xr-xsource4/dsdb/tests/python/ldap.py31
1 files changed, 6 insertions, 25 deletions
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index e148e99de6..9caca7e383 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -71,17 +71,6 @@ class BasicTests(unittest.TestCase):
res = self.ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE)
return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
- def set_dsheuristics(self, dsheuristics):
- m = Message()
- m.dn = Dn(self.ldb, "CN=Directory Service, CN=Windows NT, CN=Services, "
- + self.configuration_dn)
- if dsheuristics is not None:
- m["dSHeuristics"] = MessageElement(dsheuristics, FLAG_MOD_REPLACE,
- "dSHeuristics")
- else:
- m["dSHeuristics"] = MessageElement([], FLAG_MOD_DELETE, "dsHeuristics")
- self.ldb.modify(m)
-
def setUp(self):
super(BasicTests, self).setUp()
self.ldb = ldb
@@ -2565,30 +2554,22 @@ nTSecurityDescriptor:: """ + desc_base64
print "Tests the 'dSHeuristics' attribute"""
# Get the current value to restore it later
- res = self.ldb.search("CN=Directory Service, CN=Windows NT, CN=Services, "
- + self.configuration_dn, scope=SCOPE_BASE, attrs=["dSHeuristics"])
- if "dSHeuristics" in res[0]:
- dsheuristics = res[0]["dSHeuristics"][0]
- else:
- dsheuristics = None
+ dsheuristics = self.ldb.get_dsheuristics()
# Should not be longer than 18 chars?
try:
- self.set_dsheuristics("123ABC-+!1asdfg@#^12")
+ self.ldb.set_dsheuristics("123ABC-+!1asdfg@#^12")
except LdbError, (num, _):
self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
# If it is >= 10 chars, tenthChar should be 1
try:
- self.set_dsheuristics("00020000000002")
+ self.ldb.set_dsheuristics("00020000000002")
except LdbError, (num, _):
self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
# apart from the above, all char values are accepted
- self.set_dsheuristics("123ABC-+!1asdfg@#^")
- res = self.ldb.search("CN=Directory Service, CN=Windows NT, CN=Services, "
- + self.configuration_dn, scope=SCOPE_BASE, attrs=["dSHeuristics"])
- self.assertTrue("dSHeuristics" in res[0])
- self.assertEquals(res[0]["dSHeuristics"][0], "123ABC-+!1asdfg@#^")
+ self.ldb.set_dsheuristics("123ABC-+!1asdfg@#^")
+ self.assertEquals(self.ldb.get_dsheuristics(), "123ABC-+!1asdfg@#^")
# restore old value
- self.set_dsheuristics(dsheuristics)
+ self.ldb.set_dsheuristics(dsheuristics)
class BaseDnTests(unittest.TestCase):