]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:dsdb/tests: let password_lockout.py make use of self.addCleanup() to cleanup objects
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Feb 2016 07:37:53 +0000 (08:37 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 30 Jun 2016 01:30:25 +0000 (03:30 +0200)
This is easier than doing it by hand...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/password_lockout.py

index f76843844bfb386874090474e2f4736c1d78bacb..a71c70b11152d71029b3ff4b8acd8637fdddf29b 100755 (executable)
@@ -289,6 +289,8 @@ userAccountControl: %d
              "objectclass": "user",
              "sAMAccountName": username})
 
+        self.addCleanup(delete_force, self.ldb, userdn)
+
         res = self._check_account(userdn,
                                   badPwdCount=0,
                                   badPasswordTime=0,
@@ -1635,11 +1637,6 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le'))
 
     def tearDown(self):
         super(PasswordTests, self).tearDown()
-        delete_force(self.ldb, "cn=testuser,cn=users," + self.base_dn)
-        delete_force(self.ldb, "cn=testuser2,cn=users," + self.base_dn)
-        delete_force(self.ldb, "cn=testuser3,cn=users," + self.base_dn)
-        # Close the second LDB connection (with the user credentials)
-        self.ldb2 = None
 
 host_url = "ldap://%s" % host