[Erp5-report] r17872 - /erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Nov 28 15:22:01 CET 2007
Author: ivan
Date: Wed Nov 28 15:22:00 2007
New Revision: 17872
URL: http://svn.erp5.org?rev=17872&view=rev
Log:
Fix test to take into account timezone (see r17867 - r17870).
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=17872&r1=17871&r2=17872&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py (original)
+++ erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py Wed Nov 28 15:22:00 2007
@@ -562,17 +562,20 @@
module = portal.getDefaultModule('Organisation')
organisation = module.newContent(portal_type='Organisation',)
- creation_date = organisation.getCreationDate().ISO()
+ creation_date = organisation.getCreationDate().toZone('UTC').ISO()
+ modification_date = organisation.getModificationDate().toZone('UTC').ISO()
get_transaction().commit()
now = DateTime()
self.tic()
sql = """select creation_date, modification_date
from catalog where uid = %s""" % organisation.getUid()
result = sql_connection.manage_test(sql)
- self.assertEquals(creation_date, result[0]['creation_date'].ISO())
- self.assertEquals(organisation.getModificationDate().ISO(),
- result[0]['modification_date'].ISO())
- self.assertEquals(creation_date, result[0]['modification_date'].ISO())
+ self.assertEquals(creation_date,
+ result[0]['creation_date'].ISO())
+ self.assertEquals(modification_date,
+ result[0]['modification_date'].ISO())
+ self.assertEquals(creation_date,
+ result[0]['modification_date'].ISO())
import time; time.sleep(3)
organisation.edit(title='edited')
@@ -580,13 +583,14 @@
self.tic()
result = sql_connection.manage_test(sql)
self.assertEquals(creation_date, result[0]['creation_date'].ISO())
- self.assertNotEquals(organisation.getModificationDate(),
- organisation.getCreationDate())
+ modification_date = organisation.getModificationDate().toZone('UTC').ISO()
+ self.assertNotEquals(modification_date,
+ organisation.getCreationDate())
# 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(modification_date,
+ result[0]['modification_date'].ISO())
self.assertTrue(organisation.getModificationDate()>now)
self.assertTrue(result[0]['creation_date']<result[0]['modification_date'])
More information about the Erp5-report
mailing list