mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Filtered out 'base' from database backend choices error message.
This commit is contained in:
parent
48af591b2d
commit
bbbb7ce115
2 changed files with 18 additions and 1 deletions
17
tests/backends/test_utils.py
Normal file
17
tests/backends/test_utils.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db.utils import load_backend
|
||||
from django.test import SimpleTestCase
|
||||
from django.test.utils import str_prefix
|
||||
from django.utils import six
|
||||
|
||||
|
||||
class TestLoadBackend(SimpleTestCase):
|
||||
def test_load_backend_invalid_name(self):
|
||||
msg = str_prefix(
|
||||
"'foo' isn't an available database backend.\n"
|
||||
"Try using 'django.db.backends.XXX', where XXX is one of:\n"
|
||||
" %(_)s'mysql', %(_)s'oracle', %(_)s'postgresql_psycopg2', %(_)s'sqlite3'\n"
|
||||
"Error was: No module named %%s"
|
||||
) % "foo.base" if six.PY2 else "'foo'"
|
||||
with self.assertRaisesMessage(ImproperlyConfigured, msg):
|
||||
load_backend('foo')
|
Loading…
Add table
Add a link
Reference in a new issue