diff options
| author | Tim Graham <timograham@gmail.com> | 2013-07-04 19:58:58 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-04 20:15:27 -0400 |
| commit | d14db25feec73690b1cd52b3f8b83e3e38deb23b (patch) | |
| tree | 35b873b0a24965beea7000560a21dd700b15dae2 /tests/test_runner | |
| parent | 541a30c3768fa86ecb85ceea8545af175bada4fb (diff) | |
[1.6.x] Fixed #19940 -- Made test.runner.setup_databases properly handle aliases for default db.
Thanks simonpercivall.
Backport of 2cbd579efe from master.
Diffstat (limited to 'tests/test_runner')
| -rw-r--r-- | tests/test_runner/tests.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 0dc7a0155a..b13d0e76fc 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -290,6 +290,31 @@ class DummyBackendTest(unittest.TestCase): db.connections = old_db_connections +class AliasedDefaultTestSetupTest(unittest.TestCase): + def test_setup_aliased_default_database(self): + """ + Test that setup_datebases() doesn't fail when 'default' is aliased + """ + runner_instance = runner.DiscoverRunner(verbosity=0) + old_db_connections = db.connections + try: + db.connections = db.ConnectionHandler({ + 'default': { + 'NAME': 'dummy' + }, + 'aliased': { + 'NAME': 'dummy' + } + }) + old_config = runner_instance.setup_databases() + runner_instance.teardown_databases(old_config) + except Exception as e: + self.fail("setup_databases/teardown_databases unexpectedly raised " + "an error: %s" % e) + finally: + db.connections = old_db_connections + + class DeprecationDisplayTest(AdminScriptTestCase): # tests for 19546 def setUp(self): |
