# HG changeset patch
# User Brodie Rao <brodie@bitheap.org>
# Date 1305680828 25200
# Branch releases/1.3.X
# Node ID 6709ee4d9f37ada03979e5bd1d7b1fc737eef936
# Parent  0ea817ff93c438044844c20b1a70ceb5c6f183f2
transaction tests: add tests for confirming autocommit/isolation level changes

diff --git a/tests/modeltests/transactions/tests.py b/tests/modeltests/transactions/tests.py
--- a/tests/modeltests/transactions/tests.py
+++ b/tests/modeltests/transactions/tests.py
@@ -165,6 +165,27 @@ class TransactionTests(TransactionTestCa
             using_manually_managed_mistake
         )
 
+    @skipUnlessDBFeature('supports_transactions')
+    def test_autocommit_enabled(self):
+        """
+        Confirm that the default isolation level matches the
+        autocommit setting.
+        """
+        self.assertEqual(connection.isolation_level, int(not connection.features.uses_autocommit))
+
+    @skipUnlessDBFeature('supports_transactions')
+    def test_autocommit_restored(self):
+        """
+        If autocommit is enabled, the isolation level should return to
+        autocommit when leaving transaction management.
+        """
+
+        # The above transaction decorators do this same sort of dance.
+        transaction.enter_transaction_management()
+        transaction.managed(True)
+        transaction.leave_transaction_management()
+        self.assertEqual(connection.isolation_level, int(not connection.features.uses_autocommit))
+
 
 class TransactionRollbackTests(TransactionTestCase):
     def execute_bad_sql(self):
