[Erp5-report] r8789 - /erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jul 26 10:37:24 CEST 2006


Author: seb
Date: Wed Jul 26 10:37:22 2006
New Revision: 8789

URL: http://svn.erp5.org?rev=8789&view=rev
Log:
make sure that test_17_CreationDate_ModificationDate is working all the time, not from time to time

Modified:
    erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py

Modified: erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py?rev=8789&r1=8788&r2=8789&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py (original)
+++ erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py Wed Jul 26 10:37:22 2006
@@ -500,6 +500,7 @@
     organisation = module.newContent(portal_type='Organisation',)
     creation_date = organisation.getCreationDate().ISO()
     get_transaction().commit()
+    now = DateTime()
     self.tic()
     sql = """select creation_date, modification_date 
              from catalog where uid = %s""" % organisation.getUid()
@@ -511,18 +512,19 @@
     
     import time; time.sleep(3)
     organisation.edit(title='edited')
-    organisation.reindexObject()
-    now = DateTime().ISO()
     get_transaction().commit()
     self.tic()
     result = sql_connection.manage_test(sql)
     self.assertEquals(creation_date, result[0]['creation_date'].ISO())
     self.assertNotEquals(organisation.getModificationDate(),
                               organisation.getCreationDate())
-    self.assertEquals(organisation.getModificationDate().ISO(), now)
+    # This test was first written with a now variable initialized with
+    # DateTime(). But since we are never sure of the time required in
+    # order to execute some line of code
     self.assertEquals(organisation.getModificationDate().ISO(),
                               result[0]['modification_date'].ISO())
-    self.assertEquals(now, result[0]['modification_date'].ISO())
+    self.assertTrue(organisation.getModificationDate()>now)
+    self.assertTrue(result[0]['creation_date']<result[0]['modification_date'])
     
   def test_18_buildSQLQuery(self, quiet=0, run=0) :#run_all_test):
     """Tests that buildSQLQuery works with another query_table than 'catalog'"""




More information about the Erp5-report mailing list