test fixes
authorsylvain.thenault@logilab.fr
Fri, 16 Jan 2009 18:31:40 +0100
changeset 439 7cb7cb318983
parent 438 69b79faefa94
child 440 3b3c2b6699fd
child 462 c6e313c7a2e0
test fixes
devtools/test/data/bootstrap_cubes
devtools/test/data/bootstrap_packages
server/test/unittest_migractions.py
server/test/unittest_querier.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/devtools/test/data/bootstrap_cubes	Fri Jan 16 18:31:40 2009 +0100
@@ -0,0 +1,1 @@
+person, comment
--- a/devtools/test/data/bootstrap_packages	Fri Jan 16 18:31:13 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-eperson, ecomment
--- a/server/test/unittest_migractions.py	Fri Jan 16 18:31:13 2009 +0100
+++ b/server/test/unittest_migractions.py	Fri Jan 16 18:31:40 2009 +0100
@@ -134,7 +134,7 @@
         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', 'ECache', 'Email', 'EmailThread', 'File', 
+                          ['Affaire', 'Card', 'Division', 'Email', 'EmailThread', 'File', 
                            'Folder2', 'Image', 'Note', 'Personne', 'Societe', 'SubDivision'])
         self.assertEquals(self.schema['filed_under2'].objects(), ('Folder2',))
         eschema = self.schema.eschema('Folder2')
@@ -161,7 +161,7 @@
         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', 'ECache', 'Email', 'EmailThread', 'File', 
+                          ['Affaire', 'Card', 'Division', 'Email', 'EmailThread', 'File', 
                            'Folder2', 'Image', 'Note', 'Personne', 'Societe', 'SubDivision'])
         self.assertEquals(self.schema['filed_under2'].objects(), ('Folder2',))
 
@@ -364,23 +364,36 @@
     def test_add_remove_cube(self):
         cubes = set(self.config.cubes())
         schema = self.repo.schema
+        self.assertEquals(sorted(schema['see_also']._rproperties.keys()),
+                          sorted([('EmailThread', 'EmailThread'), ('Folder', 'Folder'),
+                                  ('Bookmark', 'Bookmark'), ('Bookmark', 'Note'),
+                                  ('Note', 'Note'), ('Note', 'Bookmark')]))
         try:
-            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'):
-                self.failIf(ertype in schema, ertype)
-            self.assertEquals(sorted(schema['see_also']._rproperties.keys()),
-                              [('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.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())
+            try:
+                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'):
+                    self.failIf(ertype in schema, ertype)
+                self.assertEquals(sorted(schema['see_also']._rproperties.keys()),
+                                  sorted([('Folder', 'Folder'),
+                                          ('Bookmark', 'Bookmark'),
+                                          ('Bookmark', 'Note'),
+                                          ('Note', 'Note'),
+                                          ('Note', 'Bookmark')]))
+                self.assertEquals(sorted(schema['see_also'].subjects()), ['Bookmark', 'Folder', 'Note'])
+                self.assertEquals(sorted(schema['see_also'].objects()), ['Bookmark', 'Folder', 'Note'])
+                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())
+            except :
+                import traceback
+                traceback.print_exc()
+                raise
         finally:
             self.mh.cmd_add_cube('email')
             cubes.add('email')
@@ -390,9 +403,13 @@
                            'sender', 'in_thread', 'reply_to', 'data_format'):
                 self.failUnless(ertype in schema, ertype)
             self.assertEquals(sorted(schema['see_also']._rproperties.keys()),
-                              [('EmailThread', 'EmailThread'), ('Folder', 'Folder')])
-            self.assertEquals(sorted(schema['see_also'].subjects()), ['EmailThread', 'Folder'])
-            self.assertEquals(sorted(schema['see_also'].objects()), ['EmailThread', 'Folder'])
+                              sorted([('EmailThread', 'EmailThread'), ('Folder', 'Folder'),
+                                      ('Bookmark', 'Bookmark'),
+                                      ('Bookmark', 'Note'),
+                                      ('Note', 'Note'),
+                                      ('Note', 'Bookmark')]))
+            self.assertEquals(sorted(schema['see_also'].subjects()), ['Bookmark', 'EmailThread', 'Folder', 'Note'])
+            self.assertEquals(sorted(schema['see_also'].objects()), ['Bookmark', 'EmailThread', 'Folder', 'Note'])
             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],
--- a/server/test/unittest_querier.py	Fri Jan 16 18:31:13 2009 +0100
+++ b/server/test/unittest_querier.py	Fri Jan 16 18:31:40 2009 +0100
@@ -454,7 +454,7 @@
                             'WHERE RT name N, RDEF relation_type RT '
                             'HAVING COUNT(RDEF) > 10')
         self.assertListEquals(rset.rows,
-                              [[u'description', 11], ['in_basket', 12],
+                              [[u'description', 11], ['in_basket', 11],
                                [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]])