def test_foreign_keys(self):
    (columns, primary_keys, foreign_keys, model_names, indexes) = self.introspector.introspect()
    self.assertEqual(foreign_keys['col_types'], [])
    rel_model = foreign_keys['rel_model']
    self.assertEqual(len(rel_model), 2)
    fkpk = foreign_keys['fkpk']
    self.assertEqual(len(fkpk), 1)
    fkpk_fk = fkpk[0]
    self.assertEqual(fkpk_fk.table, 'fkpk')
    self.assertEqual(fkpk_fk.column, 'col_types_id')
    self.assertEqual(fkpk_fk.dest_table, 'col_types')
    self.assertEqual(fkpk_fk.dest_column, 'f11')
    category = foreign_keys['category']
    self.assertEqual(len(category), 1)
    category_fk = category[0]
    self.assertEqual(category_fk.table, 'category')
    self.assertEqual(category_fk.column, 'parent_id')
    self.assertEqual(category_fk.dest_table, 'category')
    self.assertEqual(category_fk.dest_column, 'id')
def test_foreign_keys(self):
    (columns, primary_keys, foreign_keys, model_names, indexes) = self.introspector.introspect()
    self.assertEqual(foreign_keys['col_types'], [])
    rel_model = foreign_keys['rel_model']
    self.assertEqual(len(rel_model), 2)
    fkpk = foreign_keys['fkpk']
    self.assertEqual(len(fkpk), 1)
    fkpk_fk = fkpk[0]
    self.assertEqual(fkpk_fk.table, 'fkpk')
    self.assertEqual(fkpk_fk.column, 'col_types_id')
    self.assertEqual(fkpk_fk.dest_table, 'col_types')
    self.assertEqual(fkpk_fk.dest_column, 'f11')
    category = foreign_keys['category']
    self.assertEqual(len(category), 1)
    category_fk = category[0]
    self.assertEqual(category_fk.table, 'category')
    self.assertEqual(category_fk.column, 'parent_id')
    self.assertEqual(category_fk.dest_table, 'category')
    self.assertEqual(category_fk.dest_column, 'id')