summaryrefslogtreecommitdiff
path: root/tests/migrations/test_executor.py
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2014-05-08 21:48:10 -0700
committerAndrew Godwin <andrew@aeracode.org>2014-05-08 21:48:10 -0700
commitfdbd29dd27d617f7275a1a106a2934c7f8df04c7 (patch)
treefb546028b292a590ca5b81a35b41109f3218b9ec /tests/migrations/test_executor.py
parent5400b29ebfdcd8fb657bf42ddd6f81764b99f63a (diff)
Tests for #22325
Diffstat (limited to 'tests/migrations/test_executor.py')
-rw-r--r--tests/migrations/test_executor.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index e8dcacd80e..be3909d719 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -167,3 +167,25 @@ class ExecutorTests(MigrationTestBase):
executor.migrate([("migrations", None)])
self.assertTableNotExists("migrations_author")
self.assertTableNotExists("migrations_tribble")
+
+ @override_settings(
+ MIGRATION_MODULES={"migrations": "migrations.test_migrations_custom_user"},
+ AUTH_USER_MODEL="migrations.Author",
+ )
+ def test_custom_user(self):
+ """
+ Regression test for #22325 - references to a custom user model defined in the
+ same app are not resolved correctly.
+ """
+ executor = MigrationExecutor(connection)
+ self.assertTableNotExists("migrations_author")
+ self.assertTableNotExists("migrations_tribble")
+ # Migrate forwards
+ executor.migrate([("migrations", "0001_initial")])
+ self.assertTableExists("migrations_author")
+ self.assertTableExists("migrations_tribble")
+ # And migrate back to clean up the database
+ executor.loader.build_graph()
+ executor.migrate([("migrations", None)])
+ self.assertTableNotExists("migrations_author")
+ self.assertTableNotExists("migrations_tribble")