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_success(self): count = yield get_scheduled_email_count() self.assertEqual(count, 0) yield DeliverySchedule().run() notification_schedule = NotificationSchedule() notification_schedule.skip_sleep = True yield notification_schedule.run() count = yield get_scheduled_email_count() self.assertEqual(count, 0)
def test_cert_check_sched(self): count = yield get_scheduled_email_count() self.assertEqual(count, 0) yield X509CertCheckSchedule().run() count = yield get_scheduled_email_count() self.assertEqual(count, 0) X509CertCheckSchedule.notify_expr_within = 15 * 365 yield X509CertCheckSchedule().run() count = yield get_scheduled_email_count() self.assertEqual(count, 1) GLSettings.memory_copy.notif.disable_admin_notification_emails = True yield X509CertCheckSchedule().run() count = yield get_scheduled_email_count() self.assertEqual(count, 1)
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)