summaryrefslogtreecommitdiff
path: root/tests/contenttypes_tests
diff options
context:
space:
mode:
authorwrwrwr <git@wr.waw.pl>2014-11-29 18:09:40 +0100
committerTim Graham <timograham@gmail.com>2014-12-01 11:34:15 -0500
commit9136ceb6fb8225625631671147ff70c1fcfbbcdc (patch)
treefe846d89151c87b7474fbe2ef8cdedcde578dba4 /tests/contenttypes_tests
parente6f19ec3223ba7c398aea515c5e0f8b93e6f4359 (diff)
Replaced router.routers usage with override_settings(DATABASE_ROUTERS); refs #23933.
Diffstat (limited to 'tests/contenttypes_tests')
-rw-r--r--tests/contenttypes_tests/tests.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/tests/contenttypes_tests/tests.py b/tests/contenttypes_tests/tests.py
index a21d783008..0e33f40c5c 100644
--- a/tests/contenttypes_tests/tests.py
+++ b/tests/contenttypes_tests/tests.py
@@ -8,9 +8,9 @@ from django.contrib.contenttypes.fields import (
from django.contrib.contenttypes import management
from django.contrib.contenttypes.models import ContentType
from django.core import checks
-from django.db import connections, models, router
-from django.test import TestCase
-from django.test.utils import captured_stdout, override_settings
+from django.db import connections, models
+from django.test import TestCase, override_settings
+from django.test.utils import captured_stdout
from django.utils.encoding import force_str
from .models import Author, Article, SchemeIncludedURL
@@ -397,12 +397,10 @@ class TestRouter(object):
return 'default'
+@override_settings(DATABASE_ROUTERS=[TestRouter()])
class ContentTypesMultidbTestCase(TestCase):
def setUp(self):
- self.old_routers = router.routers
- router.routers = [TestRouter()]
-
# Whenever a test starts executing, only the "default" database is
# connected. We explicitly connect to the "other" database here. If we
# don't do it, then it will be implicitly connected later when we query
@@ -411,9 +409,6 @@ class ContentTypesMultidbTestCase(TestCase):
# "SET SQL_AUTO_IS_NULL = 0"), which will affect assertNumQueries().
connections['other'].ensure_connection()
- def tearDown(self):
- router.routers = self.old_routers
-
def test_multidb(self):
"""
Test that, when using multiple databases, we use the db_for_read (see