466 def test_absolute_url_empty_field(self): |
466 def test_absolute_url_empty_field(self): |
467 card = self.add_entity('Card', wikiid=u'', title=u'test') |
467 card = self.add_entity('Card', wikiid=u'', title=u'test') |
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): |
|
472 p1 = self.add_entity('Personne', nom=u'fayolle', prenom=u'alexandre') |
|
473 note = self.add_entity('Note', type=u'z') |
|
474 req = self.request() |
|
475 p = req.create_entity('Personne', nom=u'di mascio', prenom=u'adrien', |
|
476 connait=p1, evaluee=p1, |
|
477 reverse_ecrit_par=note) |
|
478 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.evaluee], ['fayolle']) |
|
481 self.assertEquals([c.type for c in p.reverse_ecrit_par], ['z']) |
|
482 |
|
483 |
471 if __name__ == '__main__': |
484 if __name__ == '__main__': |
472 from logilab.common.testlib import unittest_main |
485 from logilab.common.testlib import unittest_main |
473 unittest_main() |
486 unittest_main() |
474 |
487 |