diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-10-24 14:53:58 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-10-24 17:04:43 +0200 |
| commit | 45db842c9bcd6f9afe274c120f43847657473839 (patch) | |
| tree | 8ed9f0531c5ea41b372852aedcb1cbf34f3bb878 /tests | |
| parent | 1bdf1cb1c0a31a7759e93a514feffb84f95a7fa8 (diff) | |
Fixed #23652 -- Restored database name after destroying test database
Thanks Bjarkias for the report.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_runner/tests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 55e7a82a96..66d98a40c5 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import unittest from django import db +from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django.db.backends.dummy.base import DatabaseCreation @@ -336,6 +337,18 @@ class SetupDatabasesTests(unittest.TestCase): self.assertEqual(destroyed_names.count('dbname'), 1) + def test_destroy_test_db_restores_db_name(self): + db.connections = db.ConnectionHandler({ + 'default': { + 'ENGINE': settings.DATABASES[db.DEFAULT_DB_ALIAS]["ENGINE"], + 'NAME': 'xxx_test_database', + }, + }) + # Using the real current name as old_name to not mess with the test suite. + old_name = settings.DATABASES[db.DEFAULT_DB_ALIAS]["NAME"] + db.connections['default'].creation.destroy_test_db(old_name, verbosity=0, keepdb=True) + self.assertEqual(db.connections['default'].settings_dict["NAME"], old_name) + def test_serialization(self): serialize = [] DatabaseCreation.create_test_db = ( |
