summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-12-26 12:45:40 -0500
committerTim Graham <timograham@gmail.com>2015-01-17 09:55:18 -0500
commitf635d759354842e46901ed1ae1be5f5a0b81e567 (patch)
tree3290dea9edbd45849e9dd525a9aa7f69a75486a8 /tests
parentd038c547b5ce585cbf9ef5bb7e5298f52e4a243b (diff)
Removed support for old-style test database settings per deprecation timeline.
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/tests.py122
1 files changed, 1 insertions, 121 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 3d4185e762..04b5cd5b01 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -24,9 +24,8 @@ from django.db.models.sql.constants import CURSOR
from django.db.utils import ConnectionHandler
from django.test import (TestCase, TransactionTestCase, mock, override_settings,
skipUnlessDBFeature, skipIfDBFeature)
-from django.test.utils import ignore_warnings, str_prefix
+from django.test.utils import str_prefix
from django.utils import six
-from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.six.moves import range
from . import models
@@ -1081,125 +1080,6 @@ class BackendUtilTests(TestCase):
'1234600000')
-@ignore_warnings(category=UserWarning,
- message="Overriding setting DATABASES can lead to unexpected behavior")
-class DBTestSettingsRenamedTests(TestCase):
-
- mismatch_msg = ("Connection 'test-deprecation' has mismatched TEST "
- "and TEST_* database settings.")
-
- def setUp(self):
- super(DBTestSettingsRenamedTests, self).setUp()
- self.handler = ConnectionHandler()
- self.db_settings = {'default': {}}
-
- def test_mismatched_database_test_settings_1(self):
- # if the TEST setting is used, all TEST_* keys must appear in it.
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {},
- 'TEST_NAME': 'foo',
- }
- })
- with override_settings(DATABASES=self.db_settings):
- with self.assertRaisesMessage(ImproperlyConfigured, self.mismatch_msg):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_mismatched_database_test_settings_2(self):
- # if the TEST setting is used, all TEST_* keys must match.
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {'NAME': 'foo'},
- 'TEST_NAME': 'bar',
- },
- })
- with override_settings(DATABASES=self.db_settings):
- with self.assertRaisesMessage(ImproperlyConfigured, self.mismatch_msg):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_mismatched_database_test_settings_3(self):
- # Verifies the mapping of an aliased key.
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {'CREATE_DB': 'foo'},
- 'TEST_CREATE': 'bar',
- },
- })
- with override_settings(DATABASES=self.db_settings):
- with self.assertRaisesMessage(ImproperlyConfigured, self.mismatch_msg):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_mismatched_database_test_settings_4(self):
- # Verifies the mapping of an aliased key when the aliased key is missing.
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {},
- 'TEST_CREATE': 'bar',
- },
- })
- with override_settings(DATABASES=self.db_settings):
- with self.assertRaisesMessage(ImproperlyConfigured, self.mismatch_msg):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_mismatched_settings_old_none(self):
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {'CREATE_DB': None},
- 'TEST_CREATE': '',
- },
- })
- with override_settings(DATABASES=self.db_settings):
- with self.assertRaisesMessage(ImproperlyConfigured, self.mismatch_msg):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_mismatched_settings_new_none(self):
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {},
- 'TEST_CREATE': None,
- },
- })
- with override_settings(DATABASES=self.db_settings):
- with self.assertRaisesMessage(ImproperlyConfigured, self.mismatch_msg):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_matched_test_settings(self):
- # should be able to define new settings and the old, if they match
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {'NAME': 'foo'},
- 'TEST_NAME': 'foo',
- },
- })
- with override_settings(DATABASES=self.db_settings):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_new_settings_only(self):
- # should be able to define new settings without the old
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST': {'NAME': 'foo'},
- },
- })
- with override_settings(DATABASES=self.db_settings):
- self.handler.prepare_test_settings('test-deprecation')
-
- @ignore_warnings(category=RemovedInDjango19Warning)
- def test_old_settings_only(self):
- # should be able to define old settings without the new
- self.db_settings.update({
- 'test-deprecation': {
- 'TEST_NAME': 'foo',
- },
- })
- with override_settings(DATABASES=self.db_settings):
- self.handler.prepare_test_settings('test-deprecation')
-
- def test_empty_settings(self):
- with override_settings(DATABASES=self.db_settings):
- self.handler.prepare_test_settings('default')
-
-
@unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite specific test.')
@skipUnlessDBFeature('can_share_in_memory_db')
class TestSqliteThreadSharing(TransactionTestCase):