server/test/unittest_repository.py
changeset 8999 81a5d57d9230
parent 8947 3bbd416b09ec
child 9008 e0aa7cf8abf8
equal deleted inserted replaced
8998:4f45968cd956 8999:81a5d57d9230
    42 from cubicweb.devtools.repotest import tuplify
    42 from cubicweb.devtools.repotest import tuplify
    43 from cubicweb.server import repository, hook
    43 from cubicweb.server import repository, hook
    44 from cubicweb.server.sqlutils import SQL_PREFIX
    44 from cubicweb.server.sqlutils import SQL_PREFIX
    45 from cubicweb.server.hook import Hook
    45 from cubicweb.server.hook import Hook
    46 from cubicweb.server.sources import native
    46 from cubicweb.server.sources import native
       
    47 from cubicweb.server.session import SessionClosedError
    47 
    48 
    48 
    49 
    49 class RepositoryTC(CubicWebTC):
    50 class RepositoryTC(CubicWebTC):
    50     """ singleton providing access to a persistent storage for entities
    51     """ singleton providing access to a persistent storage for entities
    51     and relation
    52     and relation
   260         def run_transaction():
   261         def run_transaction():
   261             lock.release()
   262             lock.release()
   262             repo.execute(cnxid, 'DELETE CWUser X WHERE X login "toto"')
   263             repo.execute(cnxid, 'DELETE CWUser X WHERE X login "toto"')
   263             repo.commit(cnxid)
   264             repo.commit(cnxid)
   264         try:
   265         try:
   265             with self.assertRaises(Exception) as cm:
   266             with self.assertRaises(SessionClosedError) as cm:
   266                 run_transaction()
   267                 run_transaction()
   267             self.assertEqual(str(cm.exception), 'try to access connections set on a closed session %s' % cnxid)
   268             self.assertEqual(str(cm.exception), 'try to access connections set on a closed session %s' % cnxid)
   268         finally:
   269         finally:
   269             t.join()
   270             t.join()
   270 
   271