From 5e7d99a5d84dfc723c9be26cb7617307aaa2fb23 Mon Sep 17 00:00:00 2001 From: Nadezhda Ivanova Date: Thu, 25 Nov 2010 01:12:42 +0200 Subject: s4-tests: Modified ldap_schema.py to use samba.tests.delete_force --- source4/dsdb/tests/python/ldap_schema.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source4/dsdb/tests/python') diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py index bc7069e999..64da563e22 100755 --- a/source4/dsdb/tests/python/ldap_schema.py +++ b/source4/dsdb/tests/python/ldap_schema.py @@ -24,6 +24,7 @@ from ldb import Message, MessageElement, Dn from ldb import FLAG_MOD_REPLACE from samba.samdb import SamDB from samba.dsdb import DS_DOMAIN_FUNCTION_2003 +from samba.tests import delete_force from subunit.run import SubunitTestRunner import unittest @@ -49,12 +50,6 @@ creds = credopts.get_credentials(lp) class SchemaTests(unittest.TestCase): - def delete_force(self, ldb, dn): - try: - ldb.delete(dn) - except LdbError, (num, _): - self.assertEquals(num, ERR_NO_SUCH_OBJECT) - def setUp(self): super(SchemaTests, self).setUp() self.ldb = ldb @@ -192,7 +187,7 @@ name: """ + object_name + """ res = self.ldb.search("cn=%s,cn=Users,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["*"]) self.assertEquals(len(res), 1) # Delete the object - self.delete_force(self.ldb, "cn=%s,cn=Users,%s" % (object_name, self.base_dn)) + delete_force(self.ldb, "cn=%s,cn=Users,%s" % (object_name, self.base_dn)) def test_subClassOf(self): """ Testing usage of custom child schamaClass @@ -248,7 +243,7 @@ instanceType: 4 res = self.ldb.search("ou=%s,%s" % (object_name, self.base_dn), scope=SCOPE_BASE, attrs=["*"]) self.assertEquals(len(res), 1) # Delete the object - self.delete_force(self.ldb, "ou=%s,%s" % (object_name, self.base_dn)) + delete_force(self.ldb, "ou=%s,%s" % (object_name, self.base_dn)) class SchemaTests_msDS_IntId(unittest.TestCase): -- cgit