summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/python/ldap.py
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-20 17:36:43 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-20 18:52:31 +0200
commit91c49c2fb29a188db24695a78b365aeb4f51db27 (patch)
tree3f394c908ce3699ae83bbb8bc6673c9f71c263d0 /source4/lib/ldb/tests/python/ldap.py
parent449370db545f189449dbce75fd73271caf5ab187 (diff)
downloadsamba-91c49c2fb29a188db24695a78b365aeb4f51db27.tar.gz
samba-91c49c2fb29a188db24695a78b365aeb4f51db27.tar.bz2
samba-91c49c2fb29a188db24695a78b365aeb4f51db27.zip
s4:ldap.py - test subtree deletes through a new testcase
Diffstat (limited to 'source4/lib/ldb/tests/python/ldap.py')
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 98ff628dfe..3a0a1c0a7f 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -105,6 +105,8 @@ class BasicTests(unittest.TestCase):
self.delete_force(self.ldb, "cn=ldaptestcomputer3,cn=computers," + self.base_dn)
self.delete_force(self.ldb, "cn=ldaptestutf8user èùéìòà,cn=users," + self.base_dn)
self.delete_force(self.ldb, "cn=ldaptestutf8user2 èùéìòà,cn=users," + self.base_dn)
+ self.delete_force(self.ldb, "cn=entry1,cn=ldaptestcontainer," + self.base_dn)
+ self.delete_force(self.ldb, "cn=entry2,cn=ldaptestcontainer," + self.base_dn)
self.delete_force(self.ldb, "cn=ldaptestcontainer," + self.base_dn)
self.delete_force(self.ldb, "cn=ldaptestcontainer2," + self.base_dn)
self.delete_force(self.ldb, "cn=parentguidtest,cn=users," + self.base_dn)
@@ -1509,6 +1511,52 @@ objectClass: container
self.assertEquals(len(res), 1)
self.assertTrue("subScheamSubEntry" not in res[0])
+ def test_subtree_delete(self):
+ """Tests subtree deletes"""
+
+ print "Test subtree deletes"""
+
+ ldb.add({
+ "dn": "cn=ldaptestcontainer," + self.base_dn,
+ "objectclass": "container"})
+ ldb.add({
+ "dn": "cn=entry1,cn=ldaptestcontainer," + self.base_dn,
+ "objectclass": "container"})
+ ldb.add({
+ "dn": "cn=entry2,cn=ldaptestcontainer," + self.base_dn,
+ "objectclass": "container"})
+
+ try:
+ ldb.delete("cn=ldaptestcontainer," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NOT_ALLOWED_ON_NON_LEAF)
+
+ ldb.delete("cn=ldaptestcontainer," + self.base_dn, ["tree_delete:0"])
+
+ try:
+ res = ldb.search("cn=ldaptestcontainer," + self.base_dn,
+ scope=SCOPE_BASE, attrs=[])
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NO_SUCH_OBJECT)
+ try:
+ res = ldb.search("cn=entry1,cn=ldaptestcontainer," + self.base_dn,
+ scope=SCOPE_BASE, attrs=[])
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NO_SUCH_OBJECT)
+ try:
+ res = ldb.search("cn=entry2,cn=ldaptestcontainer," + self.base_dn,
+ scope=SCOPE_BASE, attrs=[])
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NO_SUCH_OBJECT)
+
+ self.delete_force(self.ldb, "cn=entry1,cn=ldaptestcontainer," + self.base_dn)
+ self.delete_force(self.ldb, "cn=entry2,cn=ldaptestcontainer," + self.base_dn)
+ self.delete_force(self.ldb, "cn=ldaptestcontainer," + self.base_dn)
+
def test_all(self):
"""Basic tests"""