Commit 2917e50c authored by Aurel's avatar Aurel

add test for minutes periodicity


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7843 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7a570814
...@@ -344,9 +344,31 @@ class TestAlarm(ERP5TypeTestCase): ...@@ -344,9 +344,31 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityWeekList((41,43)) alarm.setPeriodicityWeekList((41,43))
self.checkDate(alarm, right_first_date, right_second_date, right_third_date,right_fourth_date) self.checkDate(alarm, right_first_date, right_second_date, right_third_date,right_fourth_date)
def test_12_Every5Minutes(self, quiet=0, run=run_all_test):
if not run: return
if not quiet:
message = 'Test Every 5 Minutes'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
alarm = self.newAlarm()
now = DateTime()
minute_to_remove = now.minute() % 5
now = addToDate(now,minute=-minute_to_remove)
date = addToDate(now,day=2)
alarm.setPeriodicityStartDate(date)
alarm.setPeriodicityMinuteFrequency(5)
alarm.setNextAlarmDate(current_date=now)
self.assertEquals(alarm.getAlarmDate(),date)
LOG(message + ' now :',0,now)
now = addToDate(now,day=2)
LOG(message + ' now :',0,now)
alarm.setNextAlarmDate(current_date=now)
next_date = addToDate(date,minute=5)
self.assertEquals(alarm.getAlarmDate(),next_date)
now = addToDate(now,minute=5,second=14)
alarm.setNextAlarmDate(current_date=now)
next_date = addToDate(next_date,minute=5)
self.assertEquals(alarm.getAlarmDate(),next_date)
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment