1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

s4:ldap.py - perform tests on the additional delete constraint checks

This commit is contained in:
Matthias Dieter Wallnöfer
2010-08-01 13:09:46 +02:00
parent 316eda1206
commit ea5c40428f

View File

@ -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"