Ejemplo n.º 1
0
 def test_cancel_transaction(self):
     db = SteadyDBconnect(dbapi, database='ok')
     cursor = db.cursor()
     db.begin()
     cursor.execute('select test14')
     self.assertEqual(cursor.fetchone(), 'test14')
     db.cancel()
     cursor.execute('select test14')
     self.assertEqual(cursor.fetchone(), 'test14')
Ejemplo n.º 2
0
    def test_with_cancel_extension(self):
        db = SteadyDBconnect(dbapi, database='ok')
        db._con._cancel_called = None

        def cancel():
            db._con._cancel_called = 'yes'

        db._con.cancel = cancel
        db.begin()
        cursor = db.cursor()
        cursor.execute('select test15')
        self.assertEqual(cursor.fetchone(), 'test15')
        db.cancel()
        self.assertEqual(db._con._cancel_called, 'yes')