diff options
Diffstat (limited to 'source4')
-rwxr-xr-x | source4/dsdb/tests/python/ldap.py | 42 |
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" |