Esempio n. 1
0
 def test_handle_session_exception(self):
     session = mock.MagicMock()
     handler = ScopedSessionHandler(session)
     e = Exception()
     handler.handle_session(session, exc=e)
     self.assertTrue(session.rollback.called)
Esempio n. 2
0
 def test_handle_session(self):
     engine = create_engine('sqlite:///:memory:')
     handler = ScopedSessionHandler(engine)
     session = mock.MagicMock()
     handler.handle_session(session)
     self.assertTrue(session.close.called)