diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrate_signals/tests.py | 10 | ||||
| -rw-r--r-- | tests/migrations/test_executor.py | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py index d422ab84b4..bb3ea0ccc9 100644 --- a/tests/migrate_signals/tests.py +++ b/tests/migrate_signals/tests.py @@ -113,3 +113,13 @@ class MigrateSignalTests(TransactionTestCase): [model._meta.label for model in post_migrate_receiver.call_args['apps'].get_models()], ['migrate_signals.Signal'] ) + # Migrating with an empty plan. + post_migrate_receiver = Receiver(signals.post_migrate) + management.call_command( + 'migrate', database=MIGRATE_DATABASE, verbosity=MIGRATE_VERBOSITY, + interactive=MIGRATE_INTERACTIVE, stdout=stdout, + ) + self.assertEqual( + [model._meta.label for model in post_migrate_receiver.call_args['apps'].get_models()], + ['migrate_signals.Signal'] + ) diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py index b61f51f457..847b11c088 100644 --- a/tests/migrations/test_executor.py +++ b/tests/migrations/test_executor.py @@ -168,6 +168,14 @@ class ExecutorTests(MigrationTestBase): ("migrations2", "0001_initial"), ]) self.assertEqual(plan, []) + # The resulting state should include applied migrations. + state = executor.migrate([ + ("migrations", "0002_second"), + ("migrations2", "0001_initial"), + ]) + self.assertIn(('migrations', 'book'), state.models) + self.assertIn(('migrations', 'author'), state.models) + self.assertIn(('migrations2', 'otherauthor'), state.models) # Erase all the fake records executor.recorder.record_unapplied("migrations2", "0001_initial") executor.recorder.record_unapplied("migrations", "0002_second") |
