X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=examples%2Ftests.py;h=f98fbdf307abf944ba018aaa329cb59977ea42f2;hp=c677c81045ef1f40d47bc14cf4a9a1bd698c1567;hb=676eb68eb45e24287c52381e8456d297acf55c51;hpb=af1b3b17fdb43af3bd707879fcccedbede219d69 diff --git a/examples/tests.py b/examples/tests.py index c677c81..f98fbdf 100644 --- a/examples/tests.py +++ b/examples/tests.py @@ -40,9 +40,12 @@ class BaseTestCase(TestCase): def tearDown(self): cursor = connection._cursor() for base in [LdapGroup.base_dn, LdapUser.base_dn]: - results = cursor.connection.search_s(base, ldap.SCOPE_SUBTREE) - for dn, attrs in reversed(results): - cursor.connection.delete_s(dn) + try: + results = cursor.connection.search_s(base, ldap.SCOPE_SUBTREE) + for dn, attrs in reversed(results): + cursor.connection.delete_s(dn) + except ldap.NO_SUCH_OBJECT: + pass class GroupTestCase(BaseTestCase): def setUp(self):