[session] rename _tx_data into _txs
The object inside are now Transaction object. Not TransactionData object.
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.fromcubicweb.devtools.testlibimportCubicWebTCclassInternalSessionTC(CubicWebTC):deftest_dbapi_query(self):session=self.repo.internal_session()self.assertFalse(session.running_dbapi_query)session.close()classSessionTC(CubicWebTC):deftest_hooks_control(self):session=self.sessionself.assertEqual(session.hooks_mode,session.HOOKS_ALLOW_ALL)self.assertEqual(session.disabled_hook_categories,set())self.assertEqual(session.enabled_hook_categories,set())self.assertEqual(len(session._txs),1)withsession.deny_all_hooks_but('metadata'):self.assertEqual(session.hooks_mode,session.HOOKS_DENY_ALL)self.assertEqual(session.disabled_hook_categories,set())self.assertEqual(session.enabled_hook_categories,set(('metadata',)))session.commit()self.assertEqual(session.hooks_mode,session.HOOKS_DENY_ALL)self.assertEqual(session.disabled_hook_categories,set())self.assertEqual(session.enabled_hook_categories,set(('metadata',)))session.rollback()self.assertEqual(session.hooks_mode,session.HOOKS_DENY_ALL)self.assertEqual(session.disabled_hook_categories,set())self.assertEqual(session.enabled_hook_categories,set(('metadata',)))withsession.allow_all_hooks_but('integrity'):self.assertEqual(session.hooks_mode,session.HOOKS_ALLOW_ALL)self.assertEqual(session.disabled_hook_categories,set(('integrity',)))self.assertEqual(session.enabled_hook_categories,set(('metadata',)))# not changed in such caseself.assertEqual(session.hooks_mode,session.HOOKS_DENY_ALL)self.assertEqual(session.disabled_hook_categories,set())self.assertEqual(session.enabled_hook_categories,set(('metadata',)))# leaving context manager with no transaction running should reset the# transaction local storage (and associated cnxset)self.assertEqual(session._txs,{})self.assertEqual(session.cnxset,None)self.assertEqual(session.hooks_mode,session.HOOKS_ALLOW_ALL)self.assertEqual(session.disabled_hook_categories,set())self.assertEqual(session.enabled_hook_categories,set())if__name__=='__main__':fromlogilab.common.testlibimportunittest_mainunittest_main()