def _test_fail_send_mail_notify(self, mock_send_mail): mock_send_mail.side_effect = Exception('Boom!') self.assertFalse(mock_send_mail.called) result = send_mail.notify(self.user, self.scan.scan_task.target, self.scan.id) self.assertTrue(mock_send_mail.called) self.assertFalse(result)
def test_notify(self): # Empty the test outbox mail.outbox = [] result = send_mail.notify(self.user, self.scan.scan_task.target, self.scan.id) self.assertEqual(len(mail.outbox), 1) self.assertTrue(result)
def _test_fail_send_mail_notify(self, mock_send_mail): mock_send_mail.side_effect = Exception('Boom!') self.assertFalse(mock_send_mail.called) result = send_mail.notify(self.user, self.scan.scan_task.target, self.scan.id) self.assertTrue(mock_send_mail.called) self.assertFalse(result)
def test_notify(self): # Empty the test outbox mail.outbox = [] result = send_mail.notify(self.user, self.scan.scan_task.target, self.scan.id) self.assertEqual(len(mail.outbox), 1) self.assertTrue(result)