summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-07-04 20:41:01 -0400
committerTim Graham <timograham@gmail.com>2013-07-04 20:41:01 -0400
commit95aa2182b7878c1c64b1812b02caa38060ebcab4 (patch)
tree0f0a2efe30da012929976cd3c4b75a0aef6e6488 /tests
parent25d987b21e3af11b3ab3e37478a2dfd32f886d97 (diff)
[1.5.x] Fixed #19940 -- Made test.runner.setup_databases properly handle aliases for defau
Thanks simonpercivall. Backport of 2cbd579efe from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/test_runner/tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/regressiontests/test_runner/tests.py b/tests/regressiontests/test_runner/tests.py
index b5e4a1d80a..48a8e09978 100644
--- a/tests/regressiontests/test_runner/tests.py
+++ b/tests/regressiontests/test_runner/tests.py
@@ -285,6 +285,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 = DjangoTestSuiteRunner(verbosity=0)
+ old_db_connections = db.connections
+ try:
+ db.connections = db.ConnectionHandler({
+ 'default': {
+ 'NAME': 'dummy'
+ },
+ 'aliased': {
+ 'NAME': 'dummy'
+ }
+ })
+ old_config = runner.setup_databases()
+ runner.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):