def test_rollback(self): transaction.begin() zc = ZopeConnection(ConnectionStub(), TypeInfoStub()) self._txn_registered = True zc.rollback() self.assertEqual(zc._txn_registered, False, "did not forget the transaction")
def test_connection_txn_registration(self): transaction.begin() zc = ZopeConnection(ConnectionStub(), TypeInfoStub()) cursor = zc.cursor() cursor.execute('select * from blah') self.assertEqual(zc._txn_registered, True) self.assertEqual(len(transaction.get()._resources), 1)
def setUp(self): self.conn1 = ConnectionStub() self.conn2 = ConnectionStub() zc1 = ZopeConnection(self.conn1, TypeInfoStub()) self.datamgr1 = ZopeDBTransactionManager(zc1) zc2 = ZopeConnection(self.conn2, TypeInfoStub()) self.datamgr1 = ZopeDBTransactionManager(zc2) zc1.registerForTxn() zc2.registerForTxn() self.txn_factory = transaction.get
def test_getattr(self): zc = ZopeConnection(ConnectionStub(), TypeInfoStub()) cursor = zc.cursor() self.assertEqual(zc.answer(), 42)
def test_cursor(self): zc = ZopeConnection(ConnectionStub(), TypeInfoStub()) cursor = zc.cursor() self.failUnless(IZopeCursor.providedBy(cursor), "cursor is not what we expected")
def setUp(self): self.conn = ConnectionStub() zc = ZopeConnection(self.conn, TypeInfoStub()) self.datamgr = ZopeDBTransactionManager(zc) zc.registerForTxn() self.txn_factory = transaction.get