diff -r 8b35a898b334 -r 21461f80f348 server/test/unittest_querier.py --- a/server/test/unittest_querier.py Wed Jun 11 15:32:07 2014 +0200 +++ b/server/test/unittest_querier.py Wed Jun 11 17:14:32 2014 +0200 @@ -1172,11 +1172,10 @@ def test_delete_3(self): s = self.user_groups_session('users') with s.new_cnx() as cnx: - with cnx.ensure_cnx_set: - peid, = self.o.execute(cnx, "INSERT Personne P: P nom 'toto'")[0] - seid, = self.o.execute(cnx, "INSERT Societe S: S nom 'logilab'")[0] - self.o.execute(cnx, "SET P travaille S") - cnx.commit() + peid, = self.o.execute(cnx, "INSERT Personne P: P nom 'toto'")[0] + seid, = self.o.execute(cnx, "INSERT Societe S: S nom 'logilab'")[0] + self.o.execute(cnx, "SET P travaille S") + cnx.commit() rset = self.qexecute('Personne P WHERE P travaille S') self.assertEqual(len(rset.rows), 1) self.qexecute("DELETE X travaille Y WHERE X eid %s, Y eid %s" % (peid, seid)) @@ -1211,12 +1210,11 @@ 'X sender Y, X recipients Y WHERE Y is EmailAddress')[0] self.qexecute("DELETE Email X") with self.session.new_cnx() as cnx: - with cnx.ensure_cnx_set: - sqlc = cnx.cnxset.cu - sqlc.execute('SELECT * FROM recipients_relation') - self.assertEqual(len(sqlc.fetchall()), 0) - sqlc.execute('SELECT * FROM owned_by_relation WHERE eid_from=%s'%eeid) - self.assertEqual(len(sqlc.fetchall()), 0) + sqlc = cnx.cnxset.cu + sqlc.execute('SELECT * FROM recipients_relation') + self.assertEqual(len(sqlc.fetchall()), 0) + sqlc.execute('SELECT * FROM owned_by_relation WHERE eid_from=%s'%eeid) + self.assertEqual(len(sqlc.fetchall()), 0) def test_nonregr_delete_cache2(self): eid = self.qexecute("INSERT Folder T: T name 'toto'")[0][0] @@ -1363,12 +1361,11 @@ self.assertRaises(Unauthorized, self.qexecute, "Any P WHERE X is CWUser, X login 'bob', X upassword P") with self.session.new_cnx() as cnx: - with cnx.ensure_cnx_set: - cursor = cnx.cnxset.cu - cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" - % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) - passwd = str(cursor.fetchone()[0]) - self.assertEqual(passwd, crypt_password('toto', passwd)) + cursor = cnx.cnxset.cu + cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" + % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) + passwd = str(cursor.fetchone()[0]) + self.assertEqual(passwd, crypt_password('toto', passwd)) rset = self.qexecute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", {'pwd': Binary(passwd)}) self.assertEqual(len(rset.rows), 1) @@ -1376,21 +1373,20 @@ def test_update_upassword(self): with self.session.new_cnx() as cnx: - with cnx.ensure_cnx_set: - rset = cnx.execute("INSERT CWUser X: X login 'bob', X upassword %(pwd)s", - {'pwd': 'toto'}) - self.assertEqual(rset.description[0][0], 'CWUser') - rset = cnx.execute("SET X upassword %(pwd)s WHERE X is CWUser, X login 'bob'", - {'pwd': 'tutu'}) - cursor = cnx.cnxset.cu - cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" - % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) - passwd = str(cursor.fetchone()[0]) - self.assertEqual(passwd, crypt_password('tutu', passwd)) - rset = cnx.execute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", - {'pwd': Binary(passwd)}) - self.assertEqual(len(rset.rows), 1) - self.assertEqual(rset.description, [('CWUser',)]) + rset = cnx.execute("INSERT CWUser X: X login 'bob', X upassword %(pwd)s", + {'pwd': 'toto'}) + self.assertEqual(rset.description[0][0], 'CWUser') + rset = cnx.execute("SET X upassword %(pwd)s WHERE X is CWUser, X login 'bob'", + {'pwd': 'tutu'}) + cursor = cnx.cnxset.cu + cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" + % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) + passwd = str(cursor.fetchone()[0]) + self.assertEqual(passwd, crypt_password('tutu', passwd)) + rset = cnx.execute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", + {'pwd': Binary(passwd)}) + self.assertEqual(len(rset.rows), 1) + self.assertEqual(rset.description, [('CWUser',)]) # ZT datetime tests ########################################################