mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
This commit is contained in:
parent
3fe92f4477
commit
4c7bf83cde
4 changed files with 24 additions and 25 deletions
|
@ -172,11 +172,6 @@ class IntrospectionTests(TransactionTestCase):
|
|||
def test_get_indexes(self):
|
||||
with connection.cursor() as cursor:
|
||||
indexes = connection.introspection.get_indexes(cursor, Article._meta.db_table)
|
||||
if connection.features.can_introspect_index_type:
|
||||
index_type = indexes['reporter_id'].pop('type', None)
|
||||
self.assertIsNotNone(index_type)
|
||||
if connection.vendor == 'postgresql':
|
||||
self.assertEqual(index_type, 'btree')
|
||||
self.assertEqual(indexes['reporter_id'], {'unique': False, 'primary_key': False})
|
||||
|
||||
def test_get_indexes_multicol(self):
|
||||
|
@ -189,6 +184,14 @@ class IntrospectionTests(TransactionTestCase):
|
|||
self.assertNotIn('first_name', indexes)
|
||||
self.assertIn('id', indexes)
|
||||
|
||||
@skipUnlessDBFeature('can_introspect_index_type')
|
||||
def test_get_constraints_index_types(self):
|
||||
with connection.cursor() as cursor:
|
||||
constraints = connection.introspection.get_constraints(cursor, Article._meta.db_table)
|
||||
for key, val in constraints.items():
|
||||
if val['index'] and not (val['primary_key'] or val['unique']):
|
||||
self.assertEqual(val['type'], 'btree')
|
||||
|
||||
@skipUnlessDBFeature('supports_index_column_ordering')
|
||||
def test_get_constraints_indexes_orders(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue