summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-07-14 08:16:35 -0400
committerTim Graham <timograham@gmail.com>2014-07-15 15:21:44 -0400
commit01515ebaa45a7facc6b450f3fea77dcdbec85887 (patch)
tree7c30d464bb3c5e41a81606061f98e3aee98ca8c8 /tests
parentfe5f29eb1db795257d4095df0e1547c17daadade (diff)
[1.7.x] Fixed #23013 -- Fixed removing unique_together/index_together constraints in migrations.
Thanks melinath for the report. Backport of 0154965392 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_operations.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 63e9946e1e..0091ec4e59 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -899,6 +899,10 @@ class OperationTests(OperationTestBase):
operation.state_forwards("test_alunto", new_state)
self.assertEqual(len(new_state.models["test_alunto", "pony"].options.get("unique_together", set())), 1)
+ def test_alter_unique_together_remove(self):
+ operation = migrations.AlterUniqueTogether("Pony", None)
+ self.assertEqual(operation.describe(), "Alter unique_together for Pony (0 constraint(s))")
+
def test_alter_index_together(self):
"""
Tests the AlterIndexTogether operation.
@@ -922,6 +926,10 @@ class OperationTests(OperationTestBase):
operation.database_backwards("test_alinto", editor, new_state, project_state)
self.assertIndexNotExists("test_alinto_pony", ["pink", "weight"])
+ def test_alter_index_together_remove(self):
+ operation = migrations.AlterIndexTogether("Pony", None)
+ self.assertEqual(operation.describe(), "Alter index_together for Pony (0 constraint(s))")
+
def test_alter_model_options(self):
"""
Tests the AlterModelOptions operation.