equal
deleted
inserted
replaced
839 add_relations(relations) |
839 add_relations(relations) |
840 req.cnx.commit() |
840 req.cnx.commit() |
841 t1 = time.time() |
841 t1 = time.time() |
842 self.info('add relations (inlined): %.2gs', t1-t0) |
842 self.info('add relations (inlined): %.2gs', t1-t0) |
843 |
843 |
|
844 def test_optional_relation_reset_1(self): |
|
845 req = self.request() |
|
846 p1 = req.create_entity('Personne', nom=u'Vincent') |
|
847 p2 = req.create_entity('Personne', nom=u'Florent') |
|
848 w = req.create_entity('Affaire', ref=u'wc') |
|
849 w.set_relations(todo_by=[p1,p2]) |
|
850 w.clear_all_caches() |
|
851 self.commit() |
|
852 self.assertEqual(len(w.todo_by), 1) |
|
853 self.assertEqual(w.todo_by[0].eid, p2.eid) |
|
854 |
|
855 def test_optional_relation_reset_2(self): |
|
856 req = self.request() |
|
857 p1 = req.create_entity('Personne', nom=u'Vincent') |
|
858 p2 = req.create_entity('Personne', nom=u'Florent') |
|
859 w = req.create_entity('Affaire', ref=u'wc') |
|
860 w.set_relations(todo_by=p1) |
|
861 self.commit() |
|
862 w.set_relations(todo_by=p2) |
|
863 w.clear_all_caches() |
|
864 self.commit() |
|
865 self.assertEqual(len(w.todo_by), 1) |
|
866 self.assertEqual(w.todo_by[0].eid, p2.eid) |
844 |
867 |
845 |
868 |
846 if __name__ == '__main__': |
869 if __name__ == '__main__': |
847 unittest_main() |
870 unittest_main() |