Commit 684d15db authored by Łukasz Nowak's avatar Łukasz Nowak

- check alarm_date presence on first and next reindexations

Note: test_21_AlarmCatalogPresence proves that there is a bug in Alarm reindexation.
When new alarm enabled and configured alarm is added to site using one transaction
and one reindexation it will be not properly cataloged.

This affects alarm installation from Business Templates.

This problem was hidden until fix for multiple-reindexation in Business Templates
was applied.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31572 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 988655c1
No related merge requests found
......@@ -708,6 +708,33 @@ class TestAlarm(ERP5TypeTestCase):
# Actual test.
self.assertEquals(alarm.getAlarmDate(), None)
def test_21_AlarmCatalogPresence(self):
"""Check that alarm date is properly stored in catalog upon first reindexation"""
date = DateTime().earliestTime()
alarm = self.newAlarm(enabled=True, periodicity_start_date=date)
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(), date)
alarm_list = alarm.Alarm_zGetAlarmDate(uid=alarm.getUid())
self.assertEqual(1, len(alarm_list))
catalog_alarm_date = alarm_list[0].alarm_date
self.assertEqual(date.toZone('UTC'), catalog_alarm_date)
def test_21a_AlarmCatalogPresenceDoubleReindex(self):
"""Check that alarm date is properly stored in catalog"""
date = DateTime().earliestTime()
alarm = self.newAlarm(enabled=True, periodicity_start_date=date)
transaction.commit()
self.tic()
alarm.recursiveReindexObject()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(), date)
alarm_list = alarm.Alarm_zGetAlarmDate(uid=alarm.getUid())
self.assertEqual(1, len(alarm_list))
catalog_alarm_date = alarm_list[0].alarm_date
self.assertEqual(date.toZone('UTC'), catalog_alarm_date)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestAlarm))
......
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