3 from db_test import DBDakTestCase
5 from daklib.dbconn import Architecture
6 from daklib.dak_exceptions import DBUpdateError
10 class ValidatorTestCase(DBDakTestCase):
12 The ValidatorTestCase tests the validation mechanism.
15 def test_validation(self):
18 # before_insert validation should fail
19 architecture = Architecture()
20 self.session.add(architecture)
21 self.assertRaises(DBUpdateError, self.session.flush)
22 self.session.rollback()
24 architecture = Architecture('i386')
25 self.session.add(architecture)
27 # before_update validation should fail
28 architecture.arch_string = None
29 self.assertRaises(DBUpdateError, self.session.flush)
30 self.session.rollback()
32 if __name__ == '__main__':