[tests/ldap] don't leak sessions
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 16 Jun 2014 17:22:22 +0200
changeset 9794 61da050d11e4
parent 9793 52647b05bda8
child 9795 e8039b12d52e
[tests/ldap] don't leak sessions
server/test/unittest_ldapsource.py
--- a/server/test/unittest_ldapsource.py	Fri May 30 17:24:44 2014 +0200
+++ b/server/test/unittest_ldapsource.py	Mon Jun 16 17:22:22 2014 +0200
@@ -226,7 +226,9 @@
             self.assertRaises(AuthenticationError,
                               source.authenticate, cnx, 'toto', 'toto')
             self.assertTrue(source.authenticate(cnx, 'syt', 'syt'))
-        self.assertTrue(self.repo.connect('syt', password='syt'))
+        sessionid = self.repo.connect('syt', password='syt')
+        self.assertTrue(sessionid)
+        self.repo.close(sessionid)
 
     def test_base(self):
         with self.admin_access.repo_cnx() as cnx:
@@ -388,7 +390,9 @@
             cnx.commit()
         # and that we can now authenticate again
         self.assertRaises(AuthenticationError, self.repo.connect, 'syt', password='toto')
-        self.assertTrue(self.repo.connect('syt', password='syt'))
+        sessionid = self.repo.connect('syt', password='syt')
+        self.assertTrue(sessionid)
+        self.repo.close(sessionid)
 
 
 class LDAPFeedGroupTC(LDAPFeedTestBase):