Skip to content

Commit

Permalink
Updated introspection test to use skipUnlessDBFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Jan 10, 2015
1 parent d7bc37d commit ffca9b4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/introspection/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,14 @@ def test_postgresql_real_type(self):
cursor.execute('DROP TABLE django_ixn_real_test_table;')
self.assertEqual(datatype(desc[0][1], desc[0]), 'FloatField')

@skipUnlessDBFeature('can_introspect_foreign_keys')
def test_get_relations(self):
with connection.cursor() as cursor:
relations = connection.introspection.get_relations(cursor, Article._meta.db_table)

# Older versions of MySQL don't have the chops to report on this stuff,
# so just skip it if no relations come back. If they do, though, we
# should test that the response is correct.
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)})
# 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')
def test_get_key_columns(self):
Expand Down

0 comments on commit ffca9b4

Please sign in to comment.