summaryrefslogtreecommitdiff
path: root/tests/indexes
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-12-24 10:42:24 +0100
committerClaude Paroz <claude@2xlibre.net>2014-12-24 10:42:24 +0100
commit9699d8446e6fed305671721d5b1259e3e01d3ebb (patch)
treebdf3751760826b85a685cd2dd498585c96284d07 /tests/indexes
parent8842bc101cbe7bc896619856f29f3159c264e3b2 (diff)
downloaddjango-9699d8446e6fed305671721d5b1259e3e01d3ebb.tar.gz
Moved test correction from 5b1fb0a75
Diffstat (limited to 'tests/indexes')
-rw-r--r--tests/indexes/tests.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py
index 1ba9f1f044..99adc73f9c 100644
--- a/tests/indexes/tests.py
+++ b/tests/indexes/tests.py
@@ -12,16 +12,8 @@ class CreationIndexesTests(TestCase):
Test index handling by the to-be-deprecated connection.creation interface.
"""
def test_index_together(self):
- editor = connection.schema_editor()
- index_sql = editor._model_indexes_sql(Article)
+ index_sql = connection.creation.sql_indexes_for_model(Article, no_style())
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)
@@ -54,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)