test/unittest_entity.py
changeset 7314 d3104c697adb
parent 7304 66fa1b7ac784
parent 7308 ff8d6ae076c4
child 7377 d8083b2ae4d6
--- a/test/unittest_entity.py	Thu May 05 12:50:21 2011 +0200
+++ b/test/unittest_entity.py	Thu May 05 15:28:24 2011 +0200
@@ -564,6 +564,15 @@
         self.assertEqual(person.prenom, u'sylvain')
         self.assertEqual(person.nom, u'thénault')
 
+    def test_set_relations(self):
+        req = self.request()
+        person = req.create_entity('Personne', nom=u'chauvat', prenom=u'nicolas')
+        note = req.create_entity('Note', type=u'x')
+        note.set_relations(ecrit_par=person)
+        note = req.create_entity('Note', type=u'y')
+        note.set_relations(ecrit_par=person.eid)
+        self.assertEqual(len(person.reverse_ecrit_par), 2)
+
     def test_metainformation_and_external_absolute_url(self):
         req = self.request()
         note = req.create_entity('Note', type=u'z')