예제 #1
0
    def test_smtp_reconnect(self, mock_smtp):
        self.config.email.use_ssl = False
        sender = email_sender.SMTPEmailSender(self.config)

        smtp = mock_smtp.return_value
        smtp.noop.side_effect = smtplib.SMTPServerDisconnected()
        sender.send('*****@*****.**', 'Test!', 'foo bar.')

        self.assertEqual(mock_smtp.call_args_list,
                         [call(SMTP_HOST), call(SMTP_HOST)])
        smtp.sendmail.assert_called_once()
예제 #2
0
 def test_smtp_use_ssl(self, mock_smtp_ssl):
   self.config.email.use_ssl = True
   sender = email_sender.SMTPEmailSender(self.config)
   mock_smtp_ssl.assert_called_once_with(SMTP_HOST)