Fixed #22279 -- Prevented dummy backend going through DatabaseErrorWrapper

Thanks Daniel Hahler for the report and Tim Graham for the review.
This commit is contained in:
Claude Paroz 2014-12-27 16:19:32 +01:00
parent 1d24f073e6
commit 3c5d1edb39
2 changed files with 3 additions and 0 deletions

View File

@ -60,6 +60,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
# do something raises complain; anything that tries # do something raises complain; anything that tries
# to rollback or undo something raises ignore. # to rollback or undo something raises ignore.
_cursor = complain _cursor = complain
ensure_connection = complain
_commit = complain _commit = complain
_rollback = ignore _rollback = ignore
_close = ignore _close = ignore

View File

@ -41,6 +41,8 @@ class DummyBackendTest(TestCase):
conns = ConnectionHandler(DATABASES) conns = ConnectionHandler(DATABASES)
self.assertEqual(conns[DEFAULT_DB_ALIAS].settings_dict['ENGINE'], self.assertEqual(conns[DEFAULT_DB_ALIAS].settings_dict['ENGINE'],
'django.db.backends.dummy') 'django.db.backends.dummy')
with self.assertRaises(ImproperlyConfigured):
conns[DEFAULT_DB_ALIAS].ensure_connection()
@unittest.skipUnless(connection.vendor == 'oracle', "Test only for Oracle") @unittest.skipUnless(connection.vendor == 'oracle', "Test only for Oracle")