2015-07-15 14:19:38 +00:00
|
|
|
from django.core.exceptions import ImproperlyConfigured
|
|
|
|
from django.db.utils import load_backend
|
|
|
|
from django.test import SimpleTestCase
|
|
|
|
from django.utils import six
|
|
|
|
|
|
|
|
|
|
|
|
class TestLoadBackend(SimpleTestCase):
|
|
|
|
def test_load_backend_invalid_name(self):
|
2015-07-17 12:19:40 +00:00
|
|
|
msg = (
|
2015-07-15 14:19:38 +00:00
|
|
|
"'foo' isn't an available database backend.\n"
|
|
|
|
"Try using 'django.db.backends.XXX', where XXX is one of:\n"
|
2015-08-05 14:08:56 +00:00
|
|
|
" 'mysql', 'oracle', 'postgresql', 'sqlite3'\n"
|
2015-07-17 12:19:40 +00:00
|
|
|
"Error was: No module named %s"
|
2015-07-15 14:19:38 +00:00
|
|
|
) % "foo.base" if six.PY2 else "'foo'"
|
|
|
|
with self.assertRaisesMessage(ImproperlyConfigured, msg):
|
|
|
|
load_backend('foo')
|