summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Pinkham <code@andrewsforge.com>2014-09-05 17:07:42 -0700
committerTim Graham <timograham@gmail.com>2014-09-08 07:39:09 -0400
commit4680d25df23875bced0f17d361782bda80ce79d6 (patch)
tree02322d2f7649709652fd1f1685ff91c994ecbcba /tests
parentf36ab2d3f220a001745c6b7cd1712dd8415aa31c (diff)
Fixed #22951 -- Checked for types during deep_deconstruct migration serialization process.
Thanks Sam Hartsfield for the report.
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 42569d354d..e944ac87ca 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -702,6 +702,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).