summaryrefslogtreecommitdiff
path: root/source4/dsdb/tests/python
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-08-01 13:09:46 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-08-01 18:50:57 +0200
commitea5c40428f7e195f9db1efbd320969184bda6593 (patch)
tree3b7877d18d91fb7094ea8bed53302d3fddd70f68 /source4/dsdb/tests/python
parent316eda12068af4f059a082d0a9299d8fdb02d602 (diff)
downloadsamba-ea5c40428f7e195f9db1efbd320969184bda6593.tar.gz
samba-ea5c40428f7e195f9db1efbd320969184bda6593.tar.bz2
samba-ea5c40428f7e195f9db1efbd320969184bda6593.zip
s4:ldap.py - perform tests on the additional delete constraint checks
Diffstat (limited to 'source4/dsdb/tests/python')
-rwxr-xr-xsource4/dsdb/tests/python/ldap.py42
1 files changed, 38 insertions, 4 deletions
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index b48ee265c8..ea0aa3a3f9 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -1569,10 +1569,9 @@ 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"""
+ def test_delete(self):
+ """Tests the delete operation"""
+ print "Tests the delete operations"""
ldb.add({
"dn": "cn=ldaptestcontainer," + self.base_dn,
@@ -1615,6 +1614,41 @@ objectClass: container
self.delete_force(self.ldb, "cn=entry2,cn=ldaptestcontainer," + self.base_dn)
self.delete_force(self.ldb, "cn=ldaptestcontainer," + self.base_dn)
+ # Performs some protected object delete testing
+
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE,
+ attrs=["dsServiceName", "dNSHostName"])
+ self.assertEquals(len(res), 1)
+
+ try:
+ ldb.delete(res[0]["dsServiceName"][0])
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+ res = ldb.search(self.base_dn, scope=SCOPE_SUBTREE,
+ attrs=["rIDSetReferences"],
+ expression="(&(objectClass=computer)(dNSHostName=" + res[0]["dNSHostName"][0] + "))")
+ self.assertEquals(len(res), 1)
+
+ try:
+ ldb.delete(res[0]["rIDSetReferences"][0])
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+ try:
+ ldb.delete("cn=Enterprise Schema,cn=Partitions," + self.configuration_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+ try:
+ ldb.delete("cn=Enterprise Configuration,cn=Partitions," + self.configuration_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
# Performs some "systemFlags" testing
# Delete failing since "SYSTEM_FLAG_DISALLOW_DELETE"