示例#1
0
 async def test_account_matching_address_with_str(self):
     cmd = envelope.SendCommand(mail=self.mail)
     account = mock.Mock(wraps=self.MockedAccount())
     with mock.patch(
             'alot.commands.envelope.settings.account_matching_address',
             mock.Mock(return_value=account)) as account_matching_address:
         await cmd.apply(mock.Mock())
     account_matching_address.assert_called_once_with('*****@*****.**',
                                                      return_default=True)
     # check that the apply did run through till the end.
     account.send_mail.assert_called_once_with(self.mail)
示例#2
0
 def test_get_account_by_address_with_email_message(self):
     mail = email.message_from_string(self.mail)
     cmd = envelope.SendCommand(mail=mail)
     account = mock.Mock()
     with mock.patch(
             'alot.commands.envelope.settings.get_account_by_address',
             mock.Mock(return_value=account)) as get_account_by_address:
         yield cmd.apply(mock.Mock())
     get_account_by_address.assert_called_once_with('*****@*****.**',
                                                    return_default=True)
     # check that the apply did run through till the end.
     account.send_mail.assert_called_once_with(mail)