test/unittest_entity.py
branchtls-sprint
changeset 748 eec752381926
parent 744 4da6e0f4df2a
child 821 78cc1682c3a4
equal deleted inserted replaced
747:af9c15653ea9 748:eec752381926
    18     def test_boolean_value(self):
    18     def test_boolean_value(self):
    19         e = self.etype_instance('EUser')
    19         e = self.etype_instance('EUser')
    20         self.failUnless(e)
    20         self.failUnless(e)
    21 
    21 
    22     def test_yams_inheritance(self):
    22     def test_yams_inheritance(self):
    23         from entities import AnotherNote
    23         from entities import Note
    24         e = self.etype_instance('SubNote')
    24         e = self.etype_instance('SubNote')
    25         self.assertIsInstance(e, AnotherNote)
    25         self.assertIsInstance(e, Note)
    26         e2 = self.etype_instance('SubNote')
    26         e2 = self.etype_instance('SubNote')
    27         self.assertIs(e.__class__, e2.__class__)
    27         self.assertIs(e.__class__, e2.__class__)
    28 
    28 
    29     def test_has_eid(self):
    29     def test_has_eid(self):
    30         e = self.etype_instance('EUser')
    30         e = self.etype_instance('EUser')
   264                                ('created_by', 'object'),
   264                                ('created_by', 'object'),
   265                                ('wf_info_for', 'object'),
   265                                ('wf_info_for', 'object'),
   266                                ('owned_by', 'object'),
   266                                ('owned_by', 'object'),
   267                                ('bookmarked_by', 'object')])
   267                                ('bookmarked_by', 'object')])
   268         e = self.etype_instance('Personne')
   268         e = self.etype_instance('Personne')
   269         print rbc(e.relations_by_category('primary'))
       
   270         self.assertListEquals(rbc(e.relations_by_category('primary')),
   269         self.assertListEquals(rbc(e.relations_by_category('primary')),
   271                               [('nom', 'subject'), ('eid', 'subject')])
   270                               [('nom', 'subject'), ('eid', 'subject')])
   272         self.assertListEquals(rbc(e.relations_by_category('secondary')),
   271         self.assertListEquals(rbc(e.relations_by_category('secondary')),
   273                               [('prenom', 'subject'),
   272                               [('prenom', 'subject'),
   274                                ('sexe', 'subject'),
   273                                ('type', 'subject'),])
   275                                ('promo', 'subject'),
       
   276                                ('titre', 'subject'),
       
   277                                ('adel', 'subject'),
       
   278                                ('ass', 'subject'),
       
   279                                ('web', 'subject'),
       
   280                                ('tel', 'subject'),
       
   281                                ('fax', 'subject'),
       
   282                                ('datenaiss', 'subject'),
       
   283                                ('test', 'subject'),
       
   284                                ('description', 'subject'),
       
   285                                ('salary', 'subject')])
       
   286         self.assertListEquals(rbc(e.relations_by_category('generic')),
   274         self.assertListEquals(rbc(e.relations_by_category('generic')),
   287                               [('concerne', 'subject'),
   275                               [('travaille', 'subject'),
       
   276                                ('evaluee', 'subject'),
   288                                ('connait', 'subject'),
   277                                ('connait', 'subject'),
   289                                ('evaluee', 'subject'),
       
   290                                ('travaille', 'subject'),
       
   291                                ('ecrit_par', 'object'),
   278                                ('ecrit_par', 'object'),
   292                                ('evaluee', 'object'),
   279                                ('evaluee', 'object'),
   293                                ('liee_a', 'object'),
       
   294                                ('tags', 'object')])
   280                                ('tags', 'object')])
   295         self.assertListEquals(rbc(e.relations_by_category('generated')),
   281         self.assertListEquals(rbc(e.relations_by_category('generated')),
   296                               [('created_by', 'subject'),
   282                               [('created_by', 'subject'),
   297                                ('creation_date', 'subject'),
   283                                ('creation_date', 'subject'),
   298                                ('is', 'subject'),
   284                                ('is', 'subject'),