mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Tests for #22325
This commit is contained in:
parent
5400b29ebf
commit
fdbd29dd27
3 changed files with 53 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue