From 5f637a8a8d847ba02493c5ce6da55e378c3f588f Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Mon, 19 Feb 2024 18:34:18 +0100 Subject: Fixed #35226 -- Reallowed executing queries for dynamically created connections. Regression in 8fb0be3500cc7519a56985b1b6f415d75ac6fedb. Thanks Florian Apolloner for the report. --- tests/test_utils/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 7e9505f762..fab7f27aa1 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -2161,6 +2161,16 @@ class AllowedDatabaseQueriesTests(SimpleTestCase): conn.close() conn.dec_thread_sharing() + def test_allowed_database_copy_queries(self): + new_connection = connection.copy("dynamic_connection") + try: + with new_connection.cursor() as cursor: + sql = f"SELECT 1{new_connection.features.bare_select_suffix}" + cursor.execute(sql) + self.assertEqual(cursor.fetchone()[0], 1) + finally: + new_connection.close() + class DatabaseAliasTests(SimpleTestCase): def setUp(self): -- cgit v1.3