From b1e7d19d4c7015efe0c65361bb7f00a2f1c7047c Mon Sep 17 00:00:00 2001 From: Akshesh Date: Thu, 7 Jul 2016 12:00:55 +0530 Subject: Refs #26709 -- Required a name for Indexes passed to AddIndex. Thanks to Markush for discussions. --- tests/migrations/test_operations.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') 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. " + " 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() -- cgit v1.3