def testMerge(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.Nightly(self.mv, False) new = timed_event.Nightly(self.mv, False) old.Merge(new) self.assertEquals(old._deadline, new._deadline)
def testSkipMerge(self): """Test that deadline is unchanged when time of day is unchanged.""" timed_event.TimedEvent._now().MultipleTimes().AndReturn( self.BaseTime()) self.mox.ReplayAll() old = timed_event.Nightly(self.mv, False) new = timed_event.Nightly(self.mv, False) new._deadline += datetime.timedelta(days=1) self.assertNotEquals(old._deadline, new._deadline) saved_deadline = old._deadline old.Merge(new) self.assertEquals(saved_deadline, old._deadline)
def testCreateFromEmptyConfig(self): """Test that creating from empty config uses defaults.""" config = forgiving_config_parser.ForgivingConfigParser() timed_event.TimedEvent._now().MultipleTimes().AndReturn( self.BaseTime()) self.mox.ReplayAll() self.assertEquals( timed_event.Nightly(self.mv, False), timed_event.Nightly.CreateFromConfig(config, self.mv))
def CreateEvent(self): """Return an instance of timed_event.Nightly.""" return timed_event.Nightly(self.mv, False)