mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #34486 -- Fixed DatabaseOperations.compose_sql() crash with no existing database connection on PostgreSQL.
Regression in 09ffc5c121.
This commit is contained in:
committed by
Mariusz Felisiak
parent
813015d67e
commit
53aee470d5
@@ -420,3 +420,13 @@ class Tests(TestCase):
|
||||
with self.assertRaisesMessage(NotSupportedError, msg):
|
||||
connection.check_database_version_supported()
|
||||
self.assertTrue(mocked_get_database_version.called)
|
||||
|
||||
def test_compose_sql_when_no_connection(self):
|
||||
new_connection = connection.copy()
|
||||
try:
|
||||
self.assertEqual(
|
||||
new_connection.ops.compose_sql("SELECT %s", ["test"]),
|
||||
"SELECT 'test'",
|
||||
)
|
||||
finally:
|
||||
new_connection.close()
|
||||
|
||||
Reference in New Issue
Block a user