diff options
| author | Akshesh <aksheshdoshi@gmail.com> | 2016-08-25 12:42:17 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-30 08:48:55 -0400 |
| commit | 4c7bf83cde9f698cad019a9b808dbe45a832d9c3 (patch) | |
| tree | a74267c7e029b75f0b30132e706892654f45d34d /tests/postgres_tests/test_indexes.py | |
| parent | 3fe92f44770890eced6bfac75342e04106d0d536 (diff) | |
Refs #27097, #27098 -- Moved PostgreSQL index type introspection to get_constraints().
Diffstat (limited to 'tests/postgres_tests/test_indexes.py')
| -rw-r--r-- | tests/postgres_tests/test_indexes.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/postgres_tests/test_indexes.py b/tests/postgres_tests/test_indexes.py index 41bdd3beca..8c15f01d47 100644 --- a/tests/postgres_tests/test_indexes.py +++ b/tests/postgres_tests/test_indexes.py @@ -33,23 +33,24 @@ class GinIndexTests(PostgreSQLTestCase): class SchemaTests(PostgreSQLTestCase): - def get_indexes(self, table): + def get_constraints(self, table): """ Get the indexes on the table using a new cursor. """ with connection.cursor() as cursor: - return connection.introspection.get_indexes(cursor, table) + return connection.introspection.get_constraints(cursor, table) def test_gin_index(self): # Ensure the table is there and doesn't have an index. - self.assertNotIn('field', self.get_indexes(IntegerArrayModel._meta.db_table)) + self.assertNotIn('field', self.get_constraints(IntegerArrayModel._meta.db_table)) # Add the index index = GinIndex(fields=['field'], name='integer_array_model_field_gin') with connection.schema_editor() as editor: editor.add_index(IntegerArrayModel, index) - self.assertIn('field', self.get_indexes(IntegerArrayModel._meta.db_table)) - self.assertEqual(self.get_indexes(IntegerArrayModel._meta.db_table)['field']['type'], 'gin') + self.assertIn('integer_array_model_field_gin', self.get_constraints(IntegerArrayModel._meta.db_table)) + constraints = self.get_constraints(IntegerArrayModel._meta.db_table) + self.assertEqual(constraints['integer_array_model_field_gin']['type'], 'gin') # Drop the index with connection.schema_editor() as editor: editor.remove_index(IntegerArrayModel, index) - self.assertNotIn('field', self.get_indexes(IntegerArrayModel._meta.db_table)) + self.assertNotIn('integer_array_model_field_gin', self.get_constraints(IntegerArrayModel._meta.db_table)) |
