Merge pull request #2736 from SmileyChris/migration-run_before

Fixed #22725 - Migration.run_before does nothing
This commit is contained in:
Andrew Godwin 2014-06-05 20:29:26 -07:00
commit 5826dc5282
6 changed files with 115 additions and 17 deletions

View file

@ -102,6 +102,22 @@ class LoaderTests(TestCase):
["id", "user"]
)
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_run_before"})
def test_run_before(self):
"""
Makes sure the loader uses Migration.run_before.
"""
# Load and test the plan
migration_loader = MigrationLoader(connection)
self.assertEqual(
migration_loader.graph.forwards_plan(("migrations", "0002_second")),
[
("migrations", "0001_initial"),
("migrations", "0003_third"),
("migrations", "0002_second"),
],
)
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_name_match(self):
"Tests prefix name matching"