test/unittest_entity.py
branchstable
changeset 3670 b7ec030a5e10
parent 3669 4eb33ee29c84
child 3672 554a588ffaea
equal deleted inserted replaced
3669:4eb33ee29c84 3670:b7ec030a5e10
   468         self.assertEquals(card.absolute_url(),
   468         self.assertEquals(card.absolute_url(),
   469                           'http://testing.fr/cubicweb/card/eid/%s' % card.eid)
   469                           'http://testing.fr/cubicweb/card/eid/%s' % card.eid)
   470 
   470 
   471     def test_create_entity(self):
   471     def test_create_entity(self):
   472         p1 = self.add_entity('Personne', nom=u'fayolle', prenom=u'alexandre')
   472         p1 = self.add_entity('Personne', nom=u'fayolle', prenom=u'alexandre')
       
   473         p2 = self.add_entity('Personne', nom=u'campeas', prenom=u'aurelien')
   473         note = self.add_entity('Note', type=u'z')
   474         note = self.add_entity('Note', type=u'z')
   474         req = self.request()
   475         req = self.request()
   475         p = req.create_entity('Personne', nom=u'di mascio', prenom=u'adrien',
   476         p = req.create_entity('Personne', nom=u'di mascio', prenom=u'adrien',
   476                               connait=p1, evaluee=p1,
   477                               connait=p1, evaluee=[p1, p2],
   477                               reverse_ecrit_par=note)
   478                               reverse_ecrit_par=note)
   478         self.assertEquals(p.nom, 'di mascio')
   479         self.assertEquals(p.nom, 'di mascio')
   479         self.assertEquals([c.nom for c in p.connait], ['fayolle'])
   480         self.assertEquals([c.nom for c in p.connait], ['fayolle'])
   480         self.assertEquals([c.nom for c in p.evaluee], ['fayolle'])
   481         self.assertEquals(sorted([c.nom for c in p.evaluee]), ['campeas', 'fayolle'])
   481         self.assertEquals([c.type for c in p.reverse_ecrit_par], ['z'])
   482         self.assertEquals([c.type for c in p.reverse_ecrit_par], ['z'])
       
   483 
   482 
   484 
   483 
   485 
   484 if __name__ == '__main__':
   486 if __name__ == '__main__':
   485     from logilab.common.testlib import unittest_main
   487     from logilab.common.testlib import unittest_main
   486     unittest_main()
   488     unittest_main()