Example #1
0
 def test_transaction(self):
     with Transaction.begin():
         john = User(name='jonh')
         steve = User(name='steve')
         Transaction.add(john)
         Transaction.add(steve)
     self.assertEqual(3, len(User.all()))
 def test_transaction(self):
     with Transaction.begin():
         john = User(name='jonh')
         steve = User(name='steve')
         Transaction.add(john)
         Transaction.add(steve)
     self.assertEqual(3, len(User.all()))
Example #3
0
 def trans():
     try:
         with Transaction.begin():
             john = User(id=999,name='jonh')
             steve = User(id=999,name='steve')
             Transaction.add(john)
             Transaction.add(steve)
     except SQLAlchemyError:
         Transaction.rollback()
         raise
 def trans():
     try:
         with Transaction.begin():
             john = User(id=999, name='jonh')
             steve = User(id=999, name='steve')
             Transaction.add(john)
             Transaction.add(steve)
     except SQLAlchemyError:
         Transaction.rollback()
         raise
Example #5
0
 def test_delete_transaction(self):
     with Transaction.begin():
         user = User.get(id=self.user.id)
         Transaction.delete(user)
     self.assertEqual(0, len(User.all()))