summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkshesh <aksheshdoshi@gmail.com>2016-07-07 12:00:55 +0530
committerTim Graham <timograham@gmail.com>2016-07-07 07:31:23 -0400
commitb1e7d19d4c7015efe0c65361bb7f00a2f1c7047c (patch)
tree208b01df2abc364c72c4e8f8f03e8c5082efa5fe /tests
parentf1af076fbabf932dde337f09ad95369aab32d404 (diff)
Refs #26709 -- Required a name for Indexes passed to AddIndex.
Thanks to Markush for discussions.
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()