1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

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.
This commit is contained in:
Nick Pope
2022-05-12 11:54:29 +01:00
committed by Mariusz Felisiak
parent c112f837d4
commit d3677043fc
2 changed files with 11 additions and 0 deletions

View File

@@ -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(