diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2019-12-20 20:49:56 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-20 14:39:02 +0100 |
commit | 2a2ea4ee18fdcf2c95bf6435bc63b74623e3085b (patch) | |
tree | 32c7c87c71535a8493c07e2073f1bfcd1aa7e24d /tests/migrations/routers.py | |
parent | 26be703fe679a58bbdccf37a276a9c430ccb29f7 (diff) | |
download | django-2a2ea4ee18fdcf2c95bf6435bc63b74623e3085b.tar.gz |
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.
Diffstat (limited to 'tests/migrations/routers.py')
-rw-r--r-- | tests/migrations/routers.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/migrations/routers.py b/tests/migrations/routers.py index 21dfc561bd..bc036382a7 100644 --- a/tests/migrations/routers.py +++ b/tests/migrations/routers.py @@ -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 |