fix tests (some where broken after ECache was added)
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 13 Nov 2008 02:07:53 +0100
changeset 47 54087a269bdd
parent 46 0155942b5c56
child 48 0adf4d507ede
fix tests (some where broken after ECache was added)
server/test/unittest_migractions.py
server/test/unittest_querier.py
server/test/unittest_rql2sql.py
server/test/unittest_rqlrewrite.py
server/test/unittest_ssplanner.py
web/test/unittest_views_navigation.py
web/views/facets.py
--- a/server/test/unittest_migractions.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/server/test/unittest_migractions.py	Thu Nov 13 02:07:53 2008 +0100
@@ -134,8 +134,8 @@
         self.assertEquals([str(rs) for rs in self.schema['Folder2'].object_relations()],
                           ['filed_under2', 'identity'])
         self.assertEquals(sorted(str(e) for e in self.schema['filed_under2'].subjects()),
-                          ['Affaire', 'Card', 'Division', 'Email', 'EmailThread', 'File', 'Folder2',
-                           'Image', 'Note', 'Personne', 'Societe', 'SubDivision'])
+                          ['Affaire', 'Card', 'Division', 'ECache', 'Email', 'EmailThread', 'File', 
+                           'Folder2', 'Image', 'Note', 'Personne', 'Societe', 'SubDivision'])
         self.assertEquals(self.schema['filed_under2'].objects(), ('Folder2',))
         eschema = self.schema.eschema('Folder2')
         for cstr in eschema.constraints('name'):
@@ -161,8 +161,8 @@
         self.mh.cmd_add_relation_type('filed_under2')
         self.failUnless('filed_under2' in self.schema)
         self.assertEquals(sorted(str(e) for e in self.schema['filed_under2'].subjects()),
-                          ['Affaire', 'Card', 'Division', 'Email', 'EmailThread', 'File', 'Folder2',
-                           'Image', 'Note', 'Personne', 'Societe', 'SubDivision'])
+                          ['Affaire', 'Card', 'Division', 'ECache', 'Email', 'EmailThread', 'File', 
+                           'Folder2', 'Image', 'Note', 'Personne', 'Societe', 'SubDivision'])
         self.assertEquals(self.schema['filed_under2'].objects(), ('Folder2',))
 
 
@@ -365,10 +365,10 @@
         cubes = set(self.config.cubes())
         schema = self.repo.schema
         try:
-            self.mh.cmd_remove_cube('eemail')
-            # efile was there because it's an eemail dependancy, should have been removed
-            cubes.remove('eemail')
-            cubes.remove('efile')
+            self.mh.cmd_remove_cube('email')
+            # file was there because it's an email dependancy, should have been removed
+            cubes.remove('email')
+            cubes.remove('file')
             self.assertEquals(set(self.config.cubes()), cubes)
             for ertype in ('Email', 'EmailThread', 'EmailPart', 'File', 'Image', 
                            'sender', 'in_thread', 'reply_to', 'data_format'):
@@ -377,14 +377,14 @@
                               [('Folder', 'Folder')])
             self.assertEquals(schema['see_also'].subjects(), ('Folder',))
             self.assertEquals(schema['see_also'].objects(), ('Folder',))
-            self.assertEquals(self.execute('Any X WHERE X pkey "system.version.eemail"').rowcount, 0)
-            self.assertEquals(self.execute('Any X WHERE X pkey "system.version.efile"').rowcount, 0)
-            self.failIf('eemail' in self.config.cubes())
-            self.failIf('efile' in self.config.cubes())
+            self.assertEquals(self.execute('Any X WHERE X pkey "system.version.email"').rowcount, 0)
+            self.assertEquals(self.execute('Any X WHERE X pkey "system.version.file"').rowcount, 0)
+            self.failIf('email' in self.config.cubes())
+            self.failIf('file' in self.config.cubes())
         finally:
-            self.mh.cmd_add_cube('eemail')
-            cubes.add('eemail')
-            cubes.add('efile')
+            self.mh.cmd_add_cube('email')
+            cubes.add('email')
+            cubes.add('file')
             self.assertEquals(set(self.config.cubes()), cubes)
             for ertype in ('Email', 'EmailThread', 'EmailPart', 'File', 'Image', 
                            'sender', 'in_thread', 'reply_to', 'data_format'):
@@ -393,14 +393,14 @@
                               [('EmailThread', 'EmailThread'), ('Folder', 'Folder')])
             self.assertEquals(sorted(schema['see_also'].subjects()), ['EmailThread', 'Folder'])
             self.assertEquals(sorted(schema['see_also'].objects()), ['EmailThread', 'Folder'])
-            from eemail.__pkginfo__ import version as eemail_version
-            from efile.__pkginfo__ import version as efile_version
-            self.assertEquals(self.execute('Any V WHERE X value V, X pkey "system.version.eemail"')[0][0],
-                              eemail_version)
-            self.assertEquals(self.execute('Any V WHERE X value V, X pkey "system.version.efile"')[0][0],
-                              efile_version)
-            self.failUnless('eemail' in self.config.cubes())
-            self.failUnless('efile' in self.config.cubes())
+            from cubes.email.__pkginfo__ import version as email_version
+            from cubes.file.__pkginfo__ import version as file_version
+            self.assertEquals(self.execute('Any V WHERE X value V, X pkey "system.version.email"')[0][0],
+                              email_version)
+            self.assertEquals(self.execute('Any V WHERE X value V, X pkey "system.version.file"')[0][0],
+                              file_version)
+            self.failUnless('email' in self.config.cubes())
+            self.failUnless('file' in self.config.cubes())
             # trick: overwrite self.maxeid to avoid deletion of just reintroduced
             #        types (and their associated tables!)
             self.maxeid = self.execute('Any MAX(X)')[0][0]
--- a/server/test/unittest_querier.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/server/test/unittest_querier.py	Thu Nov 13 02:07:53 2008 +0100
@@ -107,12 +107,13 @@
                                        'ET': 'EEType', 'ETN': 'String'}])
         rql, solutions = partrqls[1]
         self.assertEquals(rql,  'Any ETN,X WHERE X is ET, ET name ETN, ET is EEType, '
-                          'X is IN(Bookmark, Card, Comment, Division, EConstraint, EConstraintType, EEType, EFRDef, EGroup, ENFRDef, EPermission, EProperty, ERType, EUser, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Note, Personne, RQLExpression, Societe, State, SubDivision, Tag, TrInfo, Transition)')
+                          'X is IN(Bookmark, Card, Comment, Division, ECache, EConstraint, EConstraintType, EEType, EFRDef, EGroup, ENFRDef, EPermission, EProperty, ERType, EUser, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Note, Personne, RQLExpression, Societe, State, SubDivision, Tag, TrInfo, Transition)')
         self.assertListEquals(sorted(solutions),
                               sorted([{'X': 'Bookmark', 'ETN': 'String', 'ET': 'EEType'},
                                       {'X': 'Card', 'ETN': 'String', 'ET': 'EEType'},
                                       {'X': 'Comment', 'ETN': 'String', 'ET': 'EEType'},
                                       {'X': 'Division', 'ETN': 'String', 'ET': 'EEType'},
+                                      {'X': 'ECache', 'ETN': 'String', 'ET': 'EEType'},
                                       {'X': 'EConstraint', 'ETN': 'String', 'ET': 'EEType'},
                                       {'X': 'EConstraintType', 'ETN': 'String', 'ET': 'EEType'},
                                       {'X': 'EEType', 'ETN': 'String', 'ET': 'EEType'},
@@ -453,10 +454,10 @@
                             'WHERE RT name N, RDEF relation_type RT '
                             'HAVING COUNT(RDEF) > 10')
         self.assertListEquals(rset.rows,
-                              [[u'description', 11], ['in_basket', 11],
-                               [u'name', 12], [u'created_by', 32],
-                               [u'creation_date', 32], [u'is', 32], [u'is_instance_of', 32],
-                               [u'modification_date', 32], [u'owned_by', 32]])
+                              [[u'description', 11], ['in_basket', 12],
+                               [u'name', 13], [u'created_by', 33],
+                               [u'creation_date', 33], [u'is', 33], [u'is_instance_of', 33],
+                               [u'modification_date', 33], [u'owned_by', 33]])
 
     def test_select_aggregat_having_dumb(self):
         # dumb but should not raise an error
--- a/server/test/unittest_rql2sql.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/server/test/unittest_rql2sql.py	Thu Nov 13 02:07:53 2008 +0100
@@ -340,6 +340,9 @@
 FROM Basket AS X
 UNION ALL
 SELECT X.name
+FROM ECache AS X
+UNION ALL
+SELECT X.name
 FROM EConstraintType AS X
 UNION ALL
 SELECT X.name
@@ -465,6 +468,9 @@
 FROM Basket AS X
 UNION ALL
 SELECT X.eid AS C0, X.name AS C1
+FROM ECache AS X
+UNION ALL
+SELECT X.eid AS C0, X.name AS C1
 FROM EConstraintType AS X
 UNION ALL
 SELECT X.eid AS C0, X.name AS C1
--- a/server/test/unittest_rqlrewrite.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/server/test/unittest_rqlrewrite.py	Thu Nov 13 02:07:53 2008 +0100
@@ -100,7 +100,7 @@
                              "Any S WHERE S owned_by C, C eid %(u)s, A eid %(B)s, "
                              "EXISTS((C identity A) OR (C in_state D, E identity A, "
                              "E in_state D, D name 'subscribed'), D is State, E is EUser), "
-                             "S is IN(Affaire, Basket, Bookmark, Card, Comment, Division, EConstraint, EConstraintType, EEType, EFRDef, EGroup, ENFRDef, EPermission, EProperty, ERType, EUser, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Note, Personne, RQLExpression, Societe, State, SubDivision, Tag, TrInfo, Transition)")
+                             "S is IN(Affaire, Basket, Bookmark, Card, Comment, Division, ECache, EConstraint, EConstraintType, EEType, EFRDef, EGroup, ENFRDef, EPermission, EProperty, ERType, EUser, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Note, Personne, RQLExpression, Societe, State, SubDivision, Tag, TrInfo, Transition)")
 
     def test_simplified_rqlst(self):
         card_constraint = ('X in_state S, U in_group G, P require_state S,'
--- a/server/test/unittest_ssplanner.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/server/test/unittest_ssplanner.py	Thu Nov 13 02:07:53 2008 +0100
@@ -21,6 +21,7 @@
         self._test('Any XN ORDERBY XN WHERE X name XN',
                    [('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN',
                                        [{'X': 'Basket', 'XN': 'String'},
+                                        {'X': 'ECache', 'XN': 'String'},
                                         {'X': 'EConstraintType', 'XN': 'String'},
                                         {'X': 'EEType', 'XN': 'String'},
                                         {'X': 'EGroup', 'XN': 'String'},
@@ -39,6 +40,7 @@
         self._test('Any XN,COUNT(X) GROUPBY XN WHERE X name XN',
                    [('OneFetchStep', [('Any XN,COUNT(X) GROUPBY XN WHERE X name XN',
                                        [{'X': 'Basket', 'XN': 'String'},
+                                        {'X': 'ECache', 'XN': 'String'},
                                         {'X': 'EConstraintType', 'XN': 'String'},
                                         {'X': 'EEType', 'XN': 'String'},
                                         {'X': 'EGroup', 'XN': 'String'},
--- a/web/test/unittest_views_navigation.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/web/test/unittest_views_navigation.py	Thu Nov 13 02:07:53 2008 +0100
@@ -4,9 +4,9 @@
 from cubicweb.devtools.apptest import EnvBasedTC
 
 from cubicweb.web.views.navigation import PageNavigation, SortedNavigation
+from cubicweb.web.views.ibreadcrumbs import BreadCrumbEntityVComponent
 
-from cubes.tag.views import TagsBarVComponent
-TagsBarVComponent.visible = True
+BreadCrumbEntityVComponent.visible = True
 
 class NavigationTC(EnvBasedTC):
     
@@ -73,28 +73,28 @@
         req = self.request()
         objs = self.vreg.possible_vobjects('contentnavigation', req, rset,
                                            view=view, context='navtop')
-        # tagbar should be in headers by default
+        # breadcrumbs should be in headers by default
         clsids = set(obj.id for obj in objs)
-        self.failUnless('tagbar' in clsids)
+        self.failUnless('breadcrumbs' in clsids)
         objs = self.vreg.possible_vobjects('contentnavigation', req, rset,
                                           view=view, context='navbottom')
-        # tagbar should _NOT_ be in footers by default
+        # breadcrumbs should _NOT_ be in footers by default
         clsids = set(obj.id for obj in objs)
-        self.failIf('tagbar' in clsids)
-        self.execute('INSERT EProperty P: P pkey "contentnavigation.tagbar.context", '
+        self.failIf('breadcrumbs' in clsids)
+        self.execute('INSERT EProperty P: P pkey "contentnavigation.breadcrumbs.context", '
                      'P value "navbottom"')
-        # tagbar should now be in footers
+        # breadcrumbs should now be in footers
         req.cnx.commit()
         objs = self.vreg.possible_vobjects('contentnavigation', req, rset,
                                           view=view, context='navbottom')
         
         clsids = [obj.id for obj in objs]
-        self.failUnless('tagbar' in clsids)
+        self.failUnless('breadcrumbs' in clsids)
         objs = self.vreg.possible_vobjects('contentnavigation', req, rset,
                                           view=view, context='navtop')
         
         clsids = [obj.id for obj in objs]
-        self.failIf('tagbar' in clsids)
+        self.failIf('breadcrumbs' in clsids)
         
 
 if __name__ == '__main__':
--- a/web/views/facets.py	Thu Nov 13 02:04:35 2008 +0100
+++ b/web/views/facets.py	Thu Nov 13 02:07:53 2008 +0100
@@ -97,7 +97,8 @@
             w(u'</fieldset>\n</form>\n')
         finally:
             rqlst.recover()
-            print 'after facets', rqlst
+            import cubicweb
+            cubicweb.info('after facets with rql: %s' % repr(rqlst))
 
     def get_facets(self, rset, mainvar):
         return self.vreg.possible_vobjects('facets', self.req, rset,