def check_for_slow_operations(): operations = slow_operations() if operations.count() > 0: other_than_submitted = slow_operations_other_than_submitted() if other_than_submitted.count() > 0: # there are operations that are enqueued or in progress # so sysadmins need to know too send_slow_operations_email(operations) else: # it's just 'submitted' operations that are slow # so it's just the video team's problem send_slow_operations_to_videoteam_email(operations)
def test_send_slow_operations_email(self): operations = DummyOperationsSet(1) send_slow_operations_email(operations) assert len(mail.outbox) > 0 self.assertEqual(mail.outbox[0].subject, 'Slow operations detected')