625 CALLED[:] = () |
625 CALLED[:] = () |
626 eidn = self.execute('INSERT Note N: N ecrit_par P WHERE P nom "toto"')[0][0] |
626 eidn = self.execute('INSERT Note N: N ecrit_par P WHERE P nom "toto"')[0][0] |
627 self.assertEquals(CALLED, [('before_add_relation', eidn, 'ecrit_par', eidp), |
627 self.assertEquals(CALLED, [('before_add_relation', eidn, 'ecrit_par', eidp), |
628 ('after_add_relation', eidn, 'ecrit_par', eidp)]) |
628 ('after_add_relation', eidn, 'ecrit_par', eidp)]) |
629 |
629 |
|
630 def test_unique_contraint(self): |
|
631 req = self.request() |
|
632 toto = req.create_entity('Personne', nom=u'toto') |
|
633 a01 = req.create_entity('Affaire', ref=u'A01', todo_by=toto) |
|
634 req.cnx.commit() |
|
635 req = self.request() |
|
636 req.create_entity('Note', type=u'todo', inline1=a01) |
|
637 req.cnx.commit() |
|
638 req = self.request() |
|
639 req.create_entity('Note', type=u'todo', inline1=a01) |
|
640 ex = self.assertRaises(ValidationError, req.cnx.commit) |
|
641 self.assertEquals(ex.errors, {'inline1-subject': u'RQLUniqueConstraint S type T, S inline1 A1, A1 todo_by C, Y type T, Y inline1 A2, A2 todo_by C failed'}) |
630 |
642 |
631 if __name__ == '__main__': |
643 if __name__ == '__main__': |
632 unittest_main() |
644 unittest_main() |