[Erp5-report] r17873 - in /erp5/trunk/products/ERP5: Tool/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Nov 28 15:24:14 CET 2007
Author: ivan
Date: Wed Nov 28 15:24:14 2007
New Revision: 17873
URL: http://svn.erp5.org?rev=17873&view=rev
Log:
Fix test to take into account timezone (see r17867 - r17870).
Apply Jerome's patch for converting to UTC.
Modified:
erp5/trunk/products/ERP5/Tool/DomainTool.py
erp5/trunk/products/ERP5/Tool/SimulationTool.py
erp5/trunk/products/ERP5/tests/testAlarm.py
erp5/trunk/products/ERP5/tests/testInventoryAPI.py
Modified: erp5/trunk/products/ERP5/Tool/DomainTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/DomainTool.py?rev=17873&r1=17872&r2=17873&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/DomainTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/DomainTool.py Wed Nov 28 15:24:14 2007
@@ -115,7 +115,7 @@
if value is not None:
# Handle Mysql datetime correctly
if isinstance(value, DateTime):
- value = value.ISO()
+ value = value.toZone('UTC').ISO()
format_dict['value'] = value
# Generate expression
expression += "OR (%(base_name)s = '%(value)s') " \
Modified: erp5/trunk/products/ERP5/Tool/SimulationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/SimulationTool.py?rev=17873&r1=17872&r2=17873&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/SimulationTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/SimulationTool.py Wed Nov 28 15:24:14 2007
@@ -955,7 +955,7 @@
if len(date_value_list) > 0:
date = min(date_value_list)
if isinstance(date, DateTime):
- date = date.ISO()
+ date = date.toZone('UTC').ISO()
# build a query for date to take range into account
date_query_kw = {"inventory.date" : date,
"operator" : column_value_dict.get('date', {}).get('operator', []),
Modified: erp5/trunk/products/ERP5/tests/testAlarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAlarm.py?rev=17873&r1=17872&r2=17873&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAlarm.py (original)
+++ erp5/trunk/products/ERP5/tests/testAlarm.py Wed Nov 28 15:24:14 2007
@@ -57,6 +57,8 @@
sales_order_id = '1'
quantity = 10
base_price = 0.7832
+ # year/month/day hour:minute:second
+ date_format = '%i/%i/%i %i:%i:%d UTC'
def getTitle(self):
return "Alarm"
@@ -152,7 +154,7 @@
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
alarm = self.newAlarm()
- now = DateTime()
+ now = DateTime().toZone('UTC')
hour_to_remove = now.hour() % 3
now = addToDate(now,hour=-hour_to_remove)
date = addToDate(now,day=2)
@@ -179,12 +181,12 @@
message = 'Test Some Hours'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,15,00,00))
- now = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,15,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,21,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,7,06,00,00))
- right_fourth_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,7,10,00,00))
+
+ right_first_date = DateTime(self.date_format % (2006,10,6,15,00,00))
+ now = DateTime(self.date_format % (2006,10,6,15,00,00))
+ right_second_date = DateTime(self.date_format % (2006,10,6,21,00,00))
+ right_third_date = DateTime(self.date_format % (2006,10,7,06,00,00))
+ right_fourth_date = DateTime(self.date_format % (2006,10,7,10,00,00))
alarm = self.newAlarm()
hour_list = (6,10,15,21)
alarm.setPeriodicityStartDate(now)
@@ -205,11 +207,11 @@
message = 'Every Day Once'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- now = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,10,00,00))
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,10,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,7,10,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,8,10,00,00))
+
+ now = DateTime(self.date_format % (2006,10,6,10,00,00))
+ right_first_date = DateTime(self.date_format % (2006,10,6,10,00,00))
+ right_second_date = DateTime(self.date_format % (2006,10,7,10,00,00))
+ right_third_date = DateTime(self.date_format % (2006,10,8,10,00,00))
alarm = self.newAlarm()
alarm.setPeriodicityStartDate(now)
alarm.setPeriodicityDayFrequency(1)
@@ -229,11 +231,11 @@
message = 'Every 3 Days Some Hours'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,14,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,15,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,6,17,00,00))
- right_fourth_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,9,14,00,00))
+
+ right_first_date = DateTime(self.date_format % (2006,10,6,14,00,00))
+ right_second_date = DateTime(self.date_format % (2006,10,6,15,00,00))
+ right_third_date = DateTime(self.date_format % (2006,10,6,17,00,00))
+ right_fourth_date = DateTime(self.date_format % (2006,10,9,14,00,00))
alarm = self.newAlarm()
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityDayFrequency(3)
@@ -255,11 +257,11 @@
message = 'Some Week Days Some Hours'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,9,27,6,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,9,29,15,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,2,6,00,00))
- right_fourth_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,2,15,00,00))
+
+ right_first_date = DateTime(self.date_format % (2006,9,27,6,00,00))
+ right_second_date = DateTime(self.date_format % (2006,9,29,15,00,00))
+ right_third_date = DateTime(self.date_format % (2006,10,2,6,00,00))
+ right_fourth_date = DateTime(self.date_format % (2006,10,2,15,00,00))
alarm = self.newAlarm()
get_transaction().commit()
self.tic()
@@ -293,11 +295,11 @@
message = 'Some Month Days Some Hours'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,01,12,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,01,14,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,15,12,00,00))
- right_fourth_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,15,14,00,00))
+
+ right_first_date = DateTime(self.date_format % (2006,10,01,12,00,00))
+ right_second_date = DateTime(self.date_format % (2006,10,01,14,00,00))
+ right_third_date = DateTime(self.date_format % (2006,10,15,12,00,00))
+ right_fourth_date = DateTime(self.date_format % (2006,10,15,14,00,00))
alarm = self.newAlarm()
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityMonthDayList((1,15))
@@ -313,10 +315,10 @@
message = 'Once Every 2 Month'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,01,6,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,12,01,6,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2007,2,01,6,00,00))
+
+ right_first_date = DateTime(self.date_format % (2006,10,01,6,00,00))
+ right_second_date = DateTime(self.date_format % (2006,12,01,6,00,00))
+ right_third_date = DateTime(self.date_format % (2007,2,01,6,00,00))
alarm = self.newAlarm()
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityMonthDayList((1,))
@@ -332,11 +334,11 @@
message = 'Every Day Once Week 41 And 43'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
- # year/month/day hour:minute:second
- right_first_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,1,6,00,00))
- right_second_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,9,6,00,00))
- right_third_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,10,6,00,00))
- right_fourth_date = DateTime('%i/%i/%i %i:%i:%d' % (2006,10,11,6,00,00))
+
+ right_first_date = DateTime(self.date_format % (2006,10,1,6,00,00))
+ right_second_date = DateTime(self.date_format % (2006,10,9,6,00,00))
+ right_third_date = DateTime(self.date_format % (2006,10,10,6,00,00))
+ right_fourth_date = DateTime(self.date_format % (2006,10,11,6,00,00))
alarm = self.newAlarm()
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityHourList((6,))
Modified: erp5/trunk/products/ERP5/tests/testInventoryAPI.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInventoryAPI.py?rev=17873&r1=17872&r2=17873&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInventoryAPI.py (original)
+++ erp5/trunk/products/ERP5/tests/testInventoryAPI.py Wed Nov 28 15:24:14 2007
@@ -715,9 +715,9 @@
def test_GroupByDate(self):
# group by date currently only groups by *exact* date
getInventoryList = self.getSimulationTool().getInventoryList
- self._makeMovement(quantity=1, start_date=DateTime(2000, 1, 1))
- self._makeMovement(quantity=1, start_date=DateTime(2000, 1, 1))
- self._makeMovement(quantity=1, start_date=DateTime(2001, 1, 1))
+ self._makeMovement(quantity=1, start_date=DateTime('2000/1/1 12:00 UTC'))
+ self._makeMovement(quantity=1, start_date=DateTime('2000/1/1 12:00 UTC'))
+ self._makeMovement(quantity=1, start_date=DateTime('2001/1/1 12:00 UTC'))
inventory_list = getInventoryList(node_uid=self.node.getUid(),
group_by_date=1)
self.assertEquals(2, len(inventory_list))
More information about the Erp5-report
mailing list