summaryrefslogtreecommitdiff
path: root/tests/migrations/test_executor.py
diff options
context:
space:
mode:
authorChris Beaven <smileychris@gmail.com>2014-06-23 13:29:27 +1200
committerChris Beaven <smileychris@gmail.com>2014-06-23 13:36:22 +1200
commit21c496ea52b8bdf0d97507c00a87286425dac087 (patch)
tree34b67646fd791a23d3833108cf64ef724f10e5c5 /tests/migrations/test_executor.py
parentecc06d44ed67c5bd27278244e5cf315d6fa2c893 (diff)
Fixed #22881 -- Better soft_applied migration detection
Diffstat (limited to 'tests/migrations/test_executor.py')
-rw-r--r--tests/migrations/test_executor.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index b6909a15a1..e933f9d8bd 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -155,6 +155,12 @@ class ExecutorTests(MigrationTestBase):
self.assertTableNotExists("migrations_author")
self.assertTableNotExists("migrations_tribble")
# Run it normally
+ self.assertEqual(
+ executor.migration_plan([("migrations", "0001_initial")]),
+ [
+ (executor.loader.graph.nodes["migrations", "0001_initial"], False),
+ ],
+ )
executor.migrate([("migrations", "0001_initial")])
# Are the tables there now?
self.assertTableExists("migrations_author")
@@ -171,9 +177,17 @@ class ExecutorTests(MigrationTestBase):
# Make sure that was faked
self.assertEqual(state["faked"], True)
# Finally, migrate forwards; this should fake-apply our initial migration
+ executor.loader.build_graph()
+ self.assertEqual(
+ executor.migration_plan([("migrations", "0001_initial")]),
+ [
+ (executor.loader.graph.nodes["migrations", "0001_initial"], False),
+ ],
+ )
executor.migrate([("migrations", "0001_initial")])
self.assertEqual(state["faked"], True)
# And migrate back to clean up the database
+ executor.loader.build_graph()
executor.migrate([("migrations", None)])
self.assertTableNotExists("migrations_author")
self.assertTableNotExists("migrations_tribble")