test/unittest_entity.py
changeset 3163 edfe43ceaa35
parent 2968 0e3460341023
parent 3136 ed303cf3a048
child 3293 69c0ba095536
equal deleted inserted replaced
3090:8184bec7414d 3163:edfe43ceaa35
   180 
   180 
   181     def test_related_rql(self):
   181     def test_related_rql(self):
   182         from cubicweb.entities import fetch_config
   182         from cubicweb.entities import fetch_config
   183         Personne = self.vreg['etypes'].etype_class('Personne')
   183         Personne = self.vreg['etypes'].etype_class('Personne')
   184         Note = self.vreg['etypes'].etype_class('Note')
   184         Note = self.vreg['etypes'].etype_class('Note')
       
   185         self.failUnless(issubclass(self.vreg['etypes'].etype_class('SubNote'), Note))
   185         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', 'type'))
   186         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', 'type'))
   186         Note.fetch_attrs, Note.fetch_order = fetch_config(('type',))
   187         Note.fetch_attrs, Note.fetch_order = fetch_config(('type',))
   187         aff = self.add_entity('Personne', nom=u'pouet')
   188         p = self.add_entity('Personne', nom=u'pouet')
   188         self.assertEquals(aff.related_rql('evaluee'),
   189         self.assertEquals(p.related_rql('evaluee'),
   189                           'Any X,AA,AB ORDERBY AA ASC WHERE E eid %(x)s, E evaluee X, '
   190                           'Any X,AA,AB ORDERBY AA ASC WHERE E eid %(x)s, E evaluee X, '
   190                           'X type AA, X modification_date AB')
   191                           'X type AA, X modification_date AB')
   191         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', ))
   192         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', ))
   192         # XXX
   193         # XXX
   193         self.assertEquals(aff.related_rql('evaluee'),
   194         self.assertEquals(p.related_rql('evaluee'),
   194                           'Any X,AA ORDERBY Z DESC WHERE X modification_date Z, E eid %(x)s, E evaluee X, X modification_date AA')
   195                           'Any X,AA ORDERBY Z DESC WHERE X modification_date Z, E eid %(x)s, E evaluee X, X modification_date AA')
   195 
   196 
   196     def test_entity_unrelated(self):
   197     def test_entity_unrelated(self):
   197         p = self.add_entity('Personne', nom=u'di mascio', prenom=u'adrien')
   198         p = self.add_entity('Personne', nom=u'di mascio', prenom=u'adrien')
   198         e = self.add_entity('Tag', name=u'x')
   199         e = self.add_entity('Tag', name=u'x')