Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)