def test_notification_schedule_failure(self): count = yield get_scheduled_email_count() self.assertEqual(count, 0) yield DeliverySchedule().run() notification_schedule = NotificationSchedule() notification_schedule.skip_sleep = True def sendmail_failure(x): # simulate the failure just returning with no action return succeed(None) notification_schedule.sendmail = sendmail_failure for i in range(0, 10): yield notification_schedule.run() count = yield get_scheduled_email_count() self.assertEqual(count, 28) yield notification_schedule.run() count = yield get_scheduled_email_count() self.assertEqual(count, 0)
def test_notification_schedule_failure(self): count = yield get_scheduled_email_count() self.assertEqual(count, 0) yield DeliverySchedule().run() notification_schedule = NotificationSchedule() notification_schedule.skip_sleep = True def sendmail(x, y, z): return fail(True) notification_schedule.sendmail = sendmail for i in range(0, 10): yield notification_schedule.run() count = yield get_scheduled_email_count() self.assertEqual(count, 28) yield notification_schedule.run() count = yield get_scheduled_email_count() self.assertEqual(count, 0)
def test_notification_schedule_failure(self): count = yield self.get_scheduled_email_count() self.assertEqual(count, 0) yield DeliverySchedule().run() notification_schedule = NotificationSchedule() notification_schedule.skip_sleep = True def sendmail(x, y, z): return fail(True) notification_schedule.sendmail = sendmail for i in range(0, 10): yield notification_schedule.run() count = yield self.get_scheduled_email_count() self.assertEqual(count, 40) yield notification_schedule.run() count = yield self.get_scheduled_email_count() self.assertEqual(count, 0)