summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_operations.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 01a9c8d886..0d2a6ea9bd 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -1385,7 +1385,13 @@ class OperationTests(OperationTestBase):
Test the AddIndex operation.
"""
project_state = self.set_up_test_model("test_adin")
- index = models.Index(fields=["pink"])
+ msg = (
+ "Indexes passed to AddIndex operations require a name argument. "
+ "<Index: fields='pink'> doesn't have one."
+ )
+ with self.assertRaisesMessage(ValueError, msg):
+ migrations.AddIndex("Pony", models.Index(fields=["pink"]))
+ index = models.Index(fields=["pink"], name="test_adin_pony_pink_idx")
operation = migrations.AddIndex("Pony", index)
self.assertEqual(operation.describe(), "Create index on field(s) pink of model Pony")
new_state = project_state.clone()