Esempio n. 1
0
def tls_started(conn):
    calls = conn.mock_calls
    starttls = call.starttls()
    ehlo = call.ehlo()
    return (starttls in calls and
            ehlo in calls and
            calls.index(starttls) < calls.index(ehlo))
Esempio n. 2
0
 def test_with_password(self, smtp):
     self.settings['password'] = "******"
     action = actions.SendEmailAction(
         ACTION_TYPE, ACTION_NAME, self.params, self.settings)
     action.run()
     smtpmock = smtp.return_value
     calls = [call.ehlo(), call.starttls(), call.ehlo(),
              call.login(self.settings['from'], self.settings['password'])]
     smtpmock.assert_has_calls(calls)
     self.assertTrue(smtpmock.sendmail.called, "should call sendmail")
    def test_with_password(self, smtp):
        self.settings['password'] = "******"

        action = std.SendEmailAction(self.params, self.settings)

        action.run()

        smtpmock = smtp.return_value
        calls = [
            call.ehlo(),
            call.starttls(),
            call.ehlo(),
            call.login(self.settings['from'], self.settings['password'])
        ]

        smtpmock.assert_has_calls(calls)
        self.assertTrue(smtpmock.sendmail.called, "should call sendmail")
Esempio n. 4
0
def tls_started(conn):
    calls = conn.mock_calls
    starttls = call.starttls()
    ehlo = call.ehlo()
    return (starttls in calls and ehlo in calls[calls.index(starttls) + 1:])