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