summaryrefslogtreecommitdiff
path: root/tests/commands
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-07-18 08:58:03 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-07-26 10:36:16 -0700
commit0bbf12232e86da57ce24703ff0ea82780dc27e31 (patch)
treeec5dea197e08ff277ffbd7e859ca8ec022a9bde5 /tests/commands
parent5293665df4c7747e7126d724bb53502184e958c7 (diff)
account: Convert send_mail function to coroutine
Diffstat (limited to 'tests/commands')
-rw-r--r--tests/commands/envelope_test.py13
1 files changed, 11 insertions, 2 deletions
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: