Updated introspection test to use skipUnlessDBFeature

This commit is contained in:
Claude Paroz 2015-01-10 15:42:31 +01:00
parent d7bc37d611
commit ffca9b49d4
1 changed files with 4 additions and 7 deletions

View File

@ -110,17 +110,14 @@ class IntrospectionTests(TransactionTestCase):
cursor.execute('DROP TABLE django_ixn_real_test_table;') cursor.execute('DROP TABLE django_ixn_real_test_table;')
self.assertEqual(datatype(desc[0][1], desc[0]), 'FloatField') self.assertEqual(datatype(desc[0][1], desc[0]), 'FloatField')
@skipUnlessDBFeature('can_introspect_foreign_keys')
def test_get_relations(self): def test_get_relations(self):
with connection.cursor() as cursor: with connection.cursor() as cursor:
relations = connection.introspection.get_relations(cursor, Article._meta.db_table) relations = connection.introspection.get_relations(cursor, Article._meta.db_table)
# Older versions of MySQL don't have the chops to report on this stuff, # That's {field_index: (field_index_other_table, other_table)}
# so just skip it if no relations come back. If they do, though, we self.assertEqual(relations, {3: (0, Reporter._meta.db_table),
# should test that the response is correct. 4: (0, Article._meta.db_table)})
if relations:
# That's {field_index: (field_index_other_table, other_table)}
self.assertEqual(relations, {3: (0, Reporter._meta.db_table),
4: (0, Article._meta.db_table)})
@skipUnlessDBFeature('can_introspect_foreign_keys') @skipUnlessDBFeature('can_introspect_foreign_keys')
def test_get_key_columns(self): def test_get_key_columns(self):