def test_isReminded_reminded(self): task = Task() task.dueDateTime = datetime.datetime.today() + datetime.timedelta( seconds=30) reminder = Reminder() reminder.setTime(0, 300) task.addReminder(reminder) occurrence = task.currentOccurrence() self.assertEqual(occurrence.isReminded(), True)
def test_getNotifications_reminder(self): task = Task() task.title = "task 1" task.dueDateTime = datetime.datetime.today() + datetime.timedelta( seconds=30) reminder = Reminder() reminder.setTime(0, 10) task.addReminder(reminder) notifications = task.getNotifications() self.assertEqual(len(notifications), 2) self.assertEqual(notifications[0].task, task) self.assertEqual(notifications[0].message, "task 'task 1': 0:00:10 before due time") self.assertEqual(notifications[1].task, task) self.assertEqual(notifications[1].message, "task 'task 1' reached deadline")
def test_setMillis(self): reminder = Reminder() reminder.setDays( 3 ) reminder.setMillis( 2000 ) time = reminder.splitTimeOffset() self.assertEqual( time[0], 3 ) self.assertEqual( time[1], 2 )
def test_setMillis_big(self): reminder = Reminder() reminder.setDays( 3 ) millis = 2000 + 2 * 1000 * 60 * 60 * 24 reminder.setMillis( millis ) time = reminder.splitTimeOffset() self.assertEqual( time[0], 5 ) self.assertEqual( time[1], 2 )
def _newReminder(self): reminder = Reminder() reminder.setDays( 1 ) self.task.addReminder( reminder ) self._activateWidget()
def test_printPretty_zero(self): reminder = Reminder() text = reminder.printPretty() self.assertEqual( text, "0:00:00 before due time" )
def test_printPretty(self): reminder = Reminder() reminder.setDays( 3 ) text = reminder.printPretty() self.assertEqual( text, "3 days before due time" )