diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-06-20 14:32:11 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-12-18 21:14:29 +0100 |
| commit | f46a16614d0a8339362ed7a48eef8f1914f96c85 (patch) | |
| tree | fb6265d9b9b94de0254cd679d5de41ce82c7eb24 /tests | |
| parent | 2f13a48f333ff6f4bf1fd6c22c082cd0e9120ed8 (diff) | |
[1.7.x] Fixed #24015 -- Factorized create_index_sql expression
Backport of 6072f17d0 from master, with one test reinforced.
Thanks Tim Graham for the review.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/indexes/tests.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py index 411b7646c4..99adc73f9c 100644 --- a/tests/indexes/tests.py +++ b/tests/indexes/tests.py @@ -46,8 +46,16 @@ class SchemaIndexesTests(TestCase): Test index handling by the db.backends.schema infrastructure. """ def test_index_together(self): - index_sql = connection.schema_editor()._model_indexes_sql(Article) + editor = connection.schema_editor() + index_sql = editor._model_indexes_sql(Article) self.assertEqual(len(index_sql), 1) + # Ensure the index name is properly quoted + self.assertIn( + connection.ops.quote_name( + editor._create_index_name(Article, ['headline', 'pub_date'], suffix='_idx') + ), + index_sql[0] + ) def test_index_together_single_list(self): # Test for using index_together with a single list (#22172) |
