From 3a5299c19cd5a38f7fa0f45ed2df7b10f0c9cf5d Mon Sep 17 00:00:00 2001 From: Tim Schneider Date: Fri, 12 May 2017 18:01:30 +0200 Subject: Fixed #28197 -- Fixed introspection of index field ordering on PostgreSQL. --- tests/introspection/tests.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/introspection/tests.py') diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index 4d96bf8514..c449b6de82 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -189,10 +189,14 @@ class IntrospectionTests(TransactionTestCase): with connection.cursor() as cursor: constraints = connection.introspection.get_constraints(cursor, Article._meta.db_table) index = {} + index2 = {} for key, val in constraints.items(): if val['columns'] == ['headline', 'pub_date']: index = val + if val['columns'] == ['headline', 'response_to_id', 'pub_date', 'reporter_id']: + index2 = val self.assertEqual(index['type'], Index.suffix) + self.assertEqual(index2['type'], Index.suffix) @skipUnlessDBFeature('supports_index_column_ordering') def test_get_constraints_indexes_orders(self): @@ -206,13 +210,14 @@ class IntrospectionTests(TransactionTestCase): ['reporter_id'], ['headline', 'pub_date'], ['response_to_id'], + ['headline', 'response_to_id', 'pub_date', 'reporter_id'], ] for key, val in constraints.items(): if val['index'] and not (val['primary_key'] or val['unique']): self.assertIn(val['columns'], expected_columns) self.assertEqual(val['orders'], ['ASC'] * len(val['columns'])) indexes_verified += 1 - self.assertEqual(indexes_verified, 3) + self.assertEqual(indexes_verified, 4) def datatype(dbtype, description): -- cgit v1.2.1