Ejemplo n.º 1
0
 def test_commit_unless_managed_in_managed(self):
     cursor = connection.cursor()
     connection.enter_transaction_management()
     transaction.managed(True)
     cursor.execute("INSERT into transactions_regress_mod (fld) values (2)")
     connection.commit_unless_managed()
     self.assertTrue(connection.is_dirty())
     connection.rollback()
     self.assertFalse(connection.is_dirty())
     self.assertEqual(len(Mod.objects.all()), 0)
     connection.commit()
     connection.leave_transaction_management()
     self.assertFalse(connection.is_dirty())
     self.assertEqual(len(Mod.objects.all()), 0)
     self.assertTrue(connection.is_dirty())
     connection.commit_unless_managed()
     self.assertFalse(connection.is_dirty())
     self.assertEqual(len(Mod.objects.all()), 0)
Ejemplo n.º 2
0
 def test_enter_exit_management(self):
     orig_dirty = connection._dirty
     connection.enter_transaction_management()
     connection.leave_transaction_management()
     self.assertEqual(orig_dirty, connection._dirty)
Ejemplo n.º 3
0
 def test_enter_exit_management(self):
     orig_dirty = connection._dirty
     connection.enter_transaction_management()
     connection.leave_transaction_management()
     self.assertEqual(orig_dirty, connection._dirty)