mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #32120 -- Added DatabaseFeatures.indexes_foreign_keys.
This commit is contained in:
@@ -206,17 +206,20 @@ class IntrospectionTests(TransactionTestCase):
|
||||
constraints = connection.introspection.get_constraints(cursor, Article._meta.db_table)
|
||||
indexes_verified = 0
|
||||
expected_columns = [
|
||||
['reporter_id'],
|
||||
['headline', 'pub_date'],
|
||||
['response_to_id'],
|
||||
['headline', 'response_to_id', 'pub_date', 'reporter_id'],
|
||||
]
|
||||
if connection.features.indexes_foreign_keys:
|
||||
expected_columns += [
|
||||
['reporter_id'],
|
||||
['response_to_id'],
|
||||
]
|
||||
for val in constraints.values():
|
||||
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, 4)
|
||||
self.assertEqual(indexes_verified, len(expected_columns))
|
||||
|
||||
def test_get_constraints(self):
|
||||
def assertDetails(details, cols, primary_key=False, unique=False, index=False, check=False, foreign_key=None):
|
||||
|
||||
Reference in New Issue
Block a user