mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Refs #31117 -- Made various tests properly handle unexpected databases aliases.
- Used selected "databases" instead of django.db.connections. - Made routers in tests.migrations skip migrations on unexpected databases. - Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook which properly asserts messages about skipped databases.
This commit is contained in:
committed by
Mariusz Felisiak
parent
26be703fe6
commit
2a2ea4ee18
@@ -1,5 +1,6 @@
|
||||
class EmptyRouter:
|
||||
pass
|
||||
class DefaultOtherRouter:
|
||||
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
||||
return db in {'default', 'other'}
|
||||
|
||||
|
||||
class TestRouter:
|
||||
@@ -9,5 +10,5 @@ class TestRouter:
|
||||
"""
|
||||
if model_name == 'tribble':
|
||||
return db == 'other'
|
||||
elif db == 'other':
|
||||
elif db != 'default':
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user