summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Pinkham <code@andrewsforge.com>2014-09-08 07:56:35 -0400
committerTim Graham <timograham@gmail.com>2014-09-08 07:58:06 -0400
commit27e7972e63c6f7d6555a724a3b356b4e08b0fefa (patch)
tree6037847ecc119f01c2f11a973212202f8bc059bd /tests
parent267b121b1e8a87adc61771ec786e6d9037df2462 (diff)
[1.7.x] Fixed #22951 -- Checked for types during deep_deconstruct migration serializ
Thanks Sam Hartsfield for the report. Backport of 4680d25df2 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_autodetector.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index 9c1d8c5b4a..526c018907 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -665,6 +665,31 @@ class AutodetectorTests(TestCase):
changes = autodetector._detect_changes()
self.assertEqual(changes, {})
+ def test_deconstruct_type(self):
+ """
+ #22951 -- Uninstanted classes with deconstruct are correctly returned
+ by deep_deconstruct during serialization.
+ """
+ author = ModelState(
+ "testapp",
+ "Author",
+ [
+ ("id", models.AutoField(primary_key=True)),
+ ("name", models.CharField(
+ max_length=200,
+ # IntegerField intentionally not instantiated.
+ default=models.IntegerField,
+ ))
+ ],
+ )
+ # Make state
+ before = self.make_project_state([])
+ after = self.make_project_state([author])
+ autodetector = MigrationAutodetector(before, after)
+ changes = autodetector._detect_changes()
+ self.assertNumberMigrations(changes, 'testapp', 1)
+ self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel"])
+
def test_replace_string_with_foreignkey(self):
"""
Adding an FK in the same "spot" as a deleted CharField should work. (#22300).