summaryrefslogtreecommitdiff
path: root/tests/migrations/test_deprecated_fields.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-01-17 20:42:41 -0500
committerTim Graham <timograham@gmail.com>2015-01-19 11:12:57 -0500
commit33457cd3b0da69320d3f66bb6d5a673950c5032f (patch)
treec69fca5e8972e75e15c800901984c017e69ca708 /tests/migrations/test_deprecated_fields.py
parent5008a4db440c8f7d108a6979b959025ffb5789ba (diff)
Removed IPAddressField per deprecation timeline; refs #20439.
Diffstat (limited to 'tests/migrations/test_deprecated_fields.py')
-rw-r--r--tests/migrations/test_deprecated_fields.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/migrations/test_deprecated_fields.py b/tests/migrations/test_deprecated_fields.py
new file mode 100644
index 0000000000..2e9808e20b
--- /dev/null
+++ b/tests/migrations/test_deprecated_fields.py
@@ -0,0 +1,22 @@
+from django.core.management import call_command
+from django.test import override_settings
+
+from .test_base import MigrationTestBase
+
+
+class Tests(MigrationTestBase):
+ """
+ Deprecated model fields should still be usable in historic migrations.
+ """
+ @override_settings(MIGRATION_MODULES={"migrations": "migrations.deprecated_field_migrations"})
+ def test_migrate(self):
+ # Make sure no tables are created
+ self.assertTableNotExists("migrations_ipaddressfield")
+ # Run migration
+ call_command("migrate", verbosity=0)
+ # Make sure the right tables exist
+ self.assertTableExists("migrations_ipaddressfield")
+ # Unmigrate everything
+ call_command("migrate", "migrations", "zero", verbosity=0)
+ # Make sure it's all gone
+ self.assertTableNotExists("migrations_ipaddressfield")