summaryrefslogtreecommitdiff
path: root/tests/db_utils
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2022-05-12 11:54:29 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-13 12:01:07 +0200
commitd3677043fce0fec5d082e8cae142d5e5df35a2b5 (patch)
tree4f6d2a82cfe7dbc3829c834e01940ce3387f9ec8 /tests/db_utils
parentc112f837d4960b68e912e23139bb97ef01c870a6 (diff)
downloaddjango-d3677043fce0fec5d082e8cae142d5e5df35a2b5.tar.gz
Added backward compatibility test for ConnectionHandler.databases property.
The ConnectionHandler.databases property is no longer used within Django, but it is maintained for backward compatibility with 3rd party packages that have used this private API in the past.
Diffstat (limited to 'tests/db_utils')
-rw-r--r--tests/db_utils/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/db_utils/tests.py b/tests/db_utils/tests.py
index fe1d1e2d60..9c0ec905cc 100644
--- a/tests/db_utils/tests.py
+++ b/tests/db_utils/tests.py
@@ -40,6 +40,14 @@ class ConnectionHandlerTests(SimpleTestCase):
with self.assertRaisesMessage(ImproperlyConfigured, msg):
conns["other"].ensure_connection()
+ def test_databases_property(self):
+ # The "databases" property is maintained for backwards compatibility
+ # with 3rd party packages. It should be an alias of the "settings"
+ # property.
+ conn = ConnectionHandler({})
+ self.assertNotEqual(conn.settings, {})
+ self.assertEqual(conn.settings, conn.databases)
+
def test_nonexistent_alias(self):
msg = "The connection 'nonexistent' doesn't exist."
conns = ConnectionHandler(