mirror of
https://github.com/django/django.git
synced 2025-07-19 11:15:19 +00:00
Replaced router.routers usage with override_settings(DATABASE_ROUTERS); refs #23933.
This commit is contained in:
parent
e6f19ec322
commit
9136ceb6fb
7 changed files with 121 additions and 214 deletions
|
@ -7,8 +7,8 @@ from django.apps import apps
|
|||
from django.core.management.color import no_style
|
||||
from django.core.management.sql import (sql_create, sql_delete, sql_indexes,
|
||||
sql_destroy_indexes, sql_all)
|
||||
from django.db import connections, DEFAULT_DB_ALIAS, router
|
||||
from django.test import TestCase
|
||||
from django.db import connections, DEFAULT_DB_ALIAS
|
||||
from django.test import TestCase, override_settings
|
||||
from django.utils import six
|
||||
|
||||
# See also initial_sql_regress for 'custom_sql_for_model' tests
|
||||
|
@ -91,13 +91,8 @@ class TestRouter(object):
|
|||
return False
|
||||
|
||||
|
||||
@override_settings(DATABASE_ROUTERS=[TestRouter()])
|
||||
class SQLCommandsRouterTestCase(TestCase):
|
||||
def setUp(self):
|
||||
self._old_routers = router.routers
|
||||
router.routers = [TestRouter()]
|
||||
|
||||
def tearDown(self):
|
||||
router.routers = self._old_routers
|
||||
|
||||
def test_router_honored(self):
|
||||
app_config = apps.get_app_config('commands_sql')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue