From: Matthias Dieter Wallnöfer Date: Sun, 1 Aug 2010 11:09:46 +0000 (+0200) Subject: s4:ldap.py - perform tests on the additional delete constraint checks X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=ea5c40428f7e195f9db1efbd320969184bda6593;p=abartlet%2Fsamba.git%2F.git s4:ldap.py - perform tests on the additional delete constraint checks --- diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index b48ee265c82..ea0aa3a3f93 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"