test/unittest_entity.py
changeset 9359 31a1813d53f3
parent 9340 b1e933b0e850
child 9440 6880674c1a26
--- a/test/unittest_entity.py	Thu Dec 12 12:28:43 2013 +0100
+++ b/test/unittest_entity.py	Thu Dec 12 12:34:38 2013 +0100
@@ -207,43 +207,43 @@
             # testing basic fetch_attrs attribute
             self.assertEqual(Personne.fetch_rql(user),
                               'Any X,AA,AB,AC ORDERBY AA '
-                              'WHERE X is Personne, X nom AA, X prenom AB, X modification_date AC')
+                              'WHERE X is_instance_of Personne, X nom AA, X prenom AB, X modification_date AC')
             # testing unknown attributes
             Personne.fetch_attrs = ('bloug', 'beep')
-            self.assertEqual(Personne.fetch_rql(user), 'Any X WHERE X is Personne')
+            self.assertEqual(Personne.fetch_rql(user), 'Any X WHERE X is_instance_of Personne')
             # testing one non final relation
             Personne.fetch_attrs = ('nom', 'prenom', 'travaille')
             self.assertEqual(Personne.fetch_rql(user),
                               'Any X,AA,AB,AC,AD ORDERBY AA '
-                              'WHERE X is Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD')
+                              'WHERE X is_instance_of Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD')
             # testing two non final relations
             Personne.fetch_attrs = ('nom', 'prenom', 'travaille', 'evaluee')
             self.assertEqual(Personne.fetch_rql(user),
                              'Any X,AA,AB,AC,AD,AE ORDERBY AA '
-                             'WHERE X is Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD, '
+                             'WHERE X is_instance_of Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD, '
                              'X evaluee AE?')
             # testing one non final relation with recursion
             Personne.fetch_attrs = ('nom', 'prenom', 'travaille')
             Societe.fetch_attrs = ('nom', 'evaluee')
             self.assertEqual(Personne.fetch_rql(user),
                               'Any X,AA,AB,AC,AD,AE,AF ORDERBY AA,AF DESC '
-                              'WHERE X is Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD, '
+                              'WHERE X is_instance_of Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD, '
                               'AC evaluee AE?, AE modification_date AF'
                               )
             # testing symmetric relation
             Personne.fetch_attrs = ('nom', 'connait')
             self.assertEqual(Personne.fetch_rql(user), 'Any X,AA,AB ORDERBY AA '
-                              'WHERE X is Personne, X nom AA, X connait AB?')
+                              'WHERE X is_instance_of Personne, X nom AA, X connait AB?')
             # testing optional relation
             peschema.subjrels['travaille'].rdef(peschema, seschema).cardinality = '?*'
             Personne.fetch_attrs = ('nom', 'prenom', 'travaille')
             Societe.fetch_attrs = ('nom',)
             self.assertEqual(Personne.fetch_rql(user),
-                              'Any X,AA,AB,AC,AD ORDERBY AA WHERE X is Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD')
+                              'Any X,AA,AB,AC,AD ORDERBY AA WHERE X is_instance_of Personne, X nom AA, X prenom AB, X travaille AC?, AC nom AD')
             # testing relation with cardinality > 1
             peschema.subjrels['travaille'].rdef(peschema, seschema).cardinality = '**'
             self.assertEqual(Personne.fetch_rql(user),
-                              'Any X,AA,AB ORDERBY AA WHERE X is Personne, X nom AA, X prenom AB')
+                              'Any X,AA,AB ORDERBY AA WHERE X is_instance_of Personne, X nom AA, X prenom AB')
             # XXX test unauthorized attribute
         finally:
             # fetch_attrs restored by generic tearDown
@@ -307,7 +307,7 @@
         rql = user.cw_unrelated_rql('use_email', 'EmailAddress', 'subject')[0]
         self.assertEqual(rql, 'Any O,AA,AB,AC ORDERBY AC DESC '
                          'WHERE NOT A use_email O, S eid %(x)s, '
-                         'O is EmailAddress, O address AA, O alias AB, O modification_date AC')
+                         'O is_instance_of EmailAddress, O address AA, O alias AB, O modification_date AC')
 
     def test_unrelated_rql_security_1_user(self):
         req = self.request()
@@ -317,7 +317,7 @@
         rql = user.cw_unrelated_rql('use_email', 'EmailAddress', 'subject')[0]
         self.assertEqual(rql, 'Any O,AA,AB,AC ORDERBY AC DESC '
                          'WHERE NOT A use_email O, S eid %(x)s, '
-                         'O is EmailAddress, O address AA, O alias AB, O modification_date AC')
+                         'O is_instance_of EmailAddress, O address AA, O alias AB, O modification_date AC')
         user = self.execute('Any X WHERE X login "admin"').get_entity(0, 0)
         rql = user.cw_unrelated_rql('use_email', 'EmailAddress', 'subject')[0]
         self.assertEqual(rql, 'Any O,AA,AB,AC ORDERBY AC DESC '
@@ -338,7 +338,7 @@
         email = self.execute('INSERT EmailAddress X: X address "hop"').get_entity(0, 0)
         rql = email.cw_unrelated_rql('use_email', 'CWUser', 'object')[0]
         self.assertEqual(rql, 'Any S,AA,AB,AC,AD ORDERBY AA '
-                         'WHERE NOT S use_email O, O eid %(x)s, S is CWUser, '
+                         'WHERE NOT S use_email O, O eid %(x)s, S is_instance_of CWUser, '
                          'S login AA, S firstname AB, S surname AC, S modification_date AD')
         self.login('anon')
         rperms = self.schema['EmailAddress'].permissions['read']
@@ -372,7 +372,7 @@
         rql = person.cw_unrelated_rql('connait', 'Personne', 'subject')[0]
         self.assertEqual(
             rql, 'Any O,AA,AB,AC ORDERBY AC DESC WHERE '
-            'O is Personne, O nom AA, O prenom AB, O modification_date AC')
+            'O is_instance_of Personne, O nom AA, O prenom AB, O modification_date AC')
 
     def test_unrelated_rql_constraints_creation_object(self):
         person = self.vreg['etypes'].etype_class('Personne')(self.request())
@@ -392,7 +392,7 @@
             person = self.vreg['etypes'].etype_class('Personne')(self.request())
             rql = person.cw_unrelated_rql('connait', 'Personne', 'subject')[0]
         self.assertEqual(rql, 'Any O,AA,AB,AC ORDERBY AC DESC WHERE '
-                         'O is Personne, O nom AA, O prenom AB, '
+                         'O is_instance_of Personne, O nom AA, O prenom AB, '
                          'O modification_date AC')
 
     def test_unrelated_rql_constraints_edition_subject(self):
@@ -435,7 +435,7 @@
         rql, args = person.cw_unrelated_rql('actionnaire', 'Societe', 'subject',
                                             lt_infos=lt_infos)
         self.assertEqual(u'Any O ORDERBY O WHERE NOT A actionnaire O, '
-                         u'O is Societe, NOT EXISTS(O eid %(O)s), '
+                         u'O is_instance_of Societe, NOT EXISTS(O eid %(O)s), '
                          u'A is Personne', rql)
         self.assertEqual({'O': soc.eid}, args)
 
@@ -448,7 +448,7 @@
         rql, args = soc.cw_unrelated_rql('actionnaire', 'Personne', 'object',
                                          lt_infos=lt_infos)
         self.assertEqual(u'Any S ORDERBY S WHERE NOT S actionnaire A, '
-                         u'S is Personne, NOT EXISTS(S eid %(S)s), '
+                         u'S is_instance_of Personne, NOT EXISTS(S eid %(S)s), '
                          u'A is Societe', rql)
         self.assertEqual({'S': person.eid}, args)
 
@@ -461,7 +461,7 @@
         rql, args = soc.cw_unrelated_rql('dirige', 'Personne', 'object',
                                          lt_infos=lt_infos)
         self.assertEqual(u'Any S ORDERBY S WHERE NOT S dirige A, '
-                         u'S is Personne, EXISTS(S eid %(S)s), '
+                         u'S is_instance_of Personne, EXISTS(S eid %(S)s), '
                          u'A is Societe', rql)
         self.assertEqual({'S': person.eid}, args)
 
@@ -471,7 +471,7 @@
         self.vreg['etypes'].etype_class('Personne').fetch_attrs = ()
         soc = req.create_entity('Societe', nom=u'logilab')
         rql, args = person.cw_unrelated_rql('associe', 'Personne', 'subject')
-        self.assertEqual(u'Any O ORDERBY O WHERE O is Personne', rql)
+        self.assertEqual(u'Any O ORDERBY O WHERE O is_instance_of Personne', rql)
         self.assertEqual({}, args)
 
     def test_unrelated_rql_s_linkto_s_unused_info(self):
@@ -482,7 +482,7 @@
         lt_infos = {('dirige', 'subject'): [other_p.eid]}
         rql, args = person.cw_unrelated_rql('associe', 'Personne', 'subject',
                                             lt_infos=lt_infos)
-        self.assertEqual(u'Any O ORDERBY O WHERE O is Personne', rql)
+        self.assertEqual(u'Any O ORDERBY O WHERE O is_instance_of Personne', rql)
 
     def test_unrelated_base(self):
         req = self.request()