(self)
| 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 |
nothing calls this directly
no test coverage detected