def test_rollback_from_another_thread(self): transaction = self.client.new_transaction() t = Thread(target=transaction.begin) t.start() t.join() with self.assertRaises(TransactionError): transaction.rollback()
def test_begin_and_rollback_transaction(self): transaction = self.client.new_transaction() transaction.begin() self.assertIsNotNone(transaction.id) self.assertEqual(transaction.state, hazelcast.transaction._STATE_ACTIVE) transaction.rollback() self.assertEqual(transaction.state, hazelcast.transaction._STATE_ROLLED_BACK)
def test_nested_transactions_not_allowed(self): transaction = self.client.new_transaction() transaction.begin() nested_transaction = self.client.new_transaction() with self.assertRaises(TransactionError): nested_transaction.begin() transaction.rollback()
def test_rollback_transaction_twice(self): transaction = self.client.new_transaction() transaction.begin() transaction.rollback() with self.assertRaises(TransactionError): transaction.rollback()
def test_rollback_inactive_transaction(self): transaction = self.client.new_transaction() with self.assertRaises(TransactionError): transaction.rollback()