MCPcopy
hub / github.com/django/django / test_database_name_too_long

Method test_database_name_too_long

tests/backends/postgresql/tests.py:138–150  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

136 raise DatabaseError("exception")
137
138 def test_database_name_too_long(self):
139 from django.db.backends.postgresql.base import DatabaseWrapper
140
141 settings = connection.settings_dict.copy()
142 max_name_length = connection.ops.max_name_length()
143 settings["NAME"] = "a" + (max_name_length * "a")
144 msg = (
145 "The database name '%s' (%d characters) is longer than "
146 "PostgreSQL's limit of %s characters. Supply a shorter NAME in "
147 "settings.DATABASES."
148 ) % (settings["NAME"], max_name_length + 1, max_name_length)
149 with self.assertRaisesMessage(ImproperlyConfigured, msg):
150 DatabaseWrapper(settings).get_connection_params()
151
152 def test_database_name_empty(self):
153 from django.db.backends.postgresql.base import DatabaseWrapper

Callers

nothing calls this directly

Calls 5

DatabaseWrapperClass · 0.90
assertRaisesMessageMethod · 0.80
copyMethod · 0.45
max_name_lengthMethod · 0.45
get_connection_paramsMethod · 0.45

Tested by

no test coverage detected