diff options
| author | Tim Graham <timograham@gmail.com> | 2015-07-15 10:19:38 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-07-15 10:51:26 -0400 |
| commit | bbbb7ce115ac619255100cee6dccd32ed4346d98 (patch) | |
| tree | 77a1400839b5a02339d393bd67cb4f34f942466b /tests | |
| parent | 48af591b2dd1f4c6b87558698f311dd7fe6dbbc0 (diff) | |
Filtered out 'base' from database backend choices error message.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/backends/test_utils.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/backends/test_utils.py b/tests/backends/test_utils.py new file mode 100644 index 0000000000..40a9c7b59c --- /dev/null +++ b/tests/backends/test_utils.py @@ -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') |
