Commit 8ab708ca authored by Romain Courteaud's avatar Romain Courteaud

Check that deleting an alarm uncatalogs it.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18722 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2f7f17b0
......@@ -452,6 +452,43 @@ class TestAlarm(ERP5TypeTestCase):
# Chen that the second alarm execution did happen
self.assertNotEquals(alarm.getLastActiveProcess(), None)
def test_16_uncatalog(self, quiet=0, run=run_all_test):
"""
Check that deleting a alarm uncatalogs it.
"""
if not run: return
if not quiet:
message = 'Test Uncatalog'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message)
alarm = self.newAlarm()
get_transaction().commit()
self.tic()
now = DateTime()
date = addToDate(now, day=1)
alarm.setPeriodicityStartDate(date)
get_transaction().commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(), date)
# This should not do change the alarm date
alarm.setNextAlarmDate(current_date=now)
get_transaction().commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(), date)
# Delete the alarm
a_tool = self.getAlarmTool()
alarm_uid = alarm.getUid()
a_tool.manage_delObjects(uids=[alarm_uid])
get_transaction().commit()
self.tic()
# Check that related entry was removed
sql_connection = self.getSQLConnection()
sql = 'select * from alarm where uid=%s' % alarm_uid
result = sql_connection.manage_test(sql)
self.assertEquals(0, len(result))
def test_suite():
suite = unittest.TestSuite()
......
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