def testMergeDueToTimeChange(self): """Test that Merge() works when the deadline time of day changes.""" timed_event.TimedEvent._now().MultipleTimes().AndReturn( self.BaseTime()) self.mox.ReplayAll() old = timed_event.Weekly(self.mv, False, self._HOUR) new = timed_event.Weekly(self.mv, False, self._HOUR + 1) self.assertNotEquals(old._deadline, new._deadline) old.Merge(new) self.assertEquals(old._deadline, new._deadline)
def testSkipMerge(self): """Test that deadline is unchanged when only the week is changed.""" timed_event.TimedEvent._now().MultipleTimes().AndReturn( self.BaseTime()) self.mox.ReplayAll() old = timed_event.Weekly(self.mv, False, self._HOUR) new = timed_event.Weekly(self.mv, False, self._HOUR) new._deadline += datetime.timedelta(days=7) self.assertNotEquals(old._deadline, new._deadline) saved_deadline = old._deadline old.Merge(new) self.assertEquals(saved_deadline, old._deadline)
def CreateEvent(self): """Return an instance of timed_event.Weekly.""" return timed_event.Weekly(self.mv, False, self._HOUR)