From 0bbf12232e86da57ce24703ff0ea82780dc27e31 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 18 Jul 2018 08:58:03 -0700 Subject: account: Convert send_mail function to coroutine --- tests/commands/envelope_test.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/commands/envelope_test.py b/tests/commands/envelope_test.py index 8b57e2dc..8261da34 100644 --- a/tests/commands/envelope_test.py +++ b/tests/commands/envelope_test.py @@ -30,6 +30,7 @@ from alot.db.envelope import Envelope from alot.errors import GPGProblem from alot.settings.errors import NoMatchingAccount from alot.settings.manager import SettingsManager +from alot.account import Account from .. import utilities @@ -352,10 +353,18 @@ class TestSendCommand(unittest.TestCase): Foo Bar Baz """) + class MockedAccount(Account): + + def __init__(self): + super().__init__('foo@example.com') + + async def send_mail(self, mail): + pass + @utilities.async_test async def test_get_account_by_address_with_str(self): cmd = envelope.SendCommand(mail=self.mail) - account = mock.Mock() + account = mock.Mock(wraps=self.MockedAccount()) with mock.patch( 'alot.commands.envelope.settings.get_account_by_address', mock.Mock(return_value=account)) as get_account_by_address: @@ -369,7 +378,7 @@ class TestSendCommand(unittest.TestCase): async 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() + account = mock.Mock(wraps=self.MockedAccount()) with mock.patch( 'alot.commands.envelope.settings.get_account_by_address', mock.Mock(return_value=account)) as get_account_by_address: -- cgit v1.2.3