Esempio n. 1
0
 def test_lookup_foreign_key(self):
     expected_fk = 1
     actual_fk = dbwrappers.lookup_foreign_key(self.c,
                                               self.foreign_key_table,
                                               self.fk_col_b,
                                               'csv_text_field',
                                               'foo')
     self.assertEqual(expected_fk, actual_fk)
Esempio n. 2
0
 def test_lookup_foreign_key_duplicate(self):
     """Table has 2 rows with text_field == 'bar'"""
     with self.assertRaises(dbwrappers.ForeignKeyException):
         dbwrappers.lookup_foreign_key(self.c, self.foreign_key_table,
                                       self.fk_col_b,
                                       'csv_text_field', 'bar')
Esempio n. 3
0
 def test_lookup_foreign_key_missing(self):
     """No row with text_field == 'baz'"""
     with self.assertRaises(dbwrappers.ForeignKeyException):
         dbwrappers.lookup_foreign_key(self.c, self.foreign_key_table,
                                       self.fk_col_b,
                                       'csv_text_field','baz')
Esempio n. 4
0
 def test_lookup_foreign_key_wrong_field(self):
     """'foo' is in text_field, not in date_field"""
     with self.assertRaises(dbwrappers.ForeignKeyException):
         dbwrappers.lookup_foreign_key(self.c, self.foreign_key_table,
                                       self.fk_col_b,
                                       'csv_date_field', 'foo')