File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ def _rollback(self):
189189 pass
190190
191191 def set_autocommit (self , autocommit , force_begin_transaction_with_broken_autocommit = False ):
192- pass
192+ self . autocommit = autocommit
193193
194194 @async_unsafe
195195 def close (self ):
Original file line number Diff line number Diff line change 11from django .core .exceptions import ImproperlyConfigured
22from django .db import connection
3- from django .test import SimpleTestCase
3+ from django .test import SimpleTestCase , TestCase
44
55from django_mongodb_backend .base import DatabaseWrapper
66
@@ -12,3 +12,12 @@ def test_database_name_empty(self):
1212 msg = 'settings.DATABASES is missing the "NAME" value.'
1313 with self .assertRaisesMessage (ImproperlyConfigured , msg ):
1414 DatabaseWrapper (settings ).get_connection_params ()
15+
16+
17+ class DatabaseWrapperConnectionTests (TestCase ):
18+ def test_set_autocommit (self ):
19+ self .assertIs (connection .get_autocommit (), True )
20+ connection .set_autocommit (False )
21+ self .assertIs (connection .get_autocommit (), False )
22+ connection .set_autocommit (True )
23+ self .assertIs (connection .get_autocommit (), True )
You can’t perform that action at this time.
0 commit comments