diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-07-17 21:39:29 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-07-26 10:36:11 -0700 |
commit | 1af48c55cd5b0bf67b545db7c99fcf46be51a3ba (patch) | |
tree | aca9c16449ae3c1e6a5fbf141d3e7bbb87c0b68e /tests/commands | |
parent | ada6b6678cef75e237194233536bab8ee6a6bf19 (diff) |
tests/commands/envelope: use utilities.async_test
Diffstat (limited to 'tests/commands')
-rw-r--r-- | tests/commands/envelope_test.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/commands/envelope_test.py b/tests/commands/envelope_test.py index d3908be8..8b57e2dc 100644 --- a/tests/commands/envelope_test.py +++ b/tests/commands/envelope_test.py @@ -1,5 +1,5 @@ # encoding=utf-8 -# Copyright © 2017 Dylan Baker +# Copyright © 2017-2018 Dylan Baker # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ import tempfile import textwrap from twisted.trial import unittest -from twisted.internet.defer import inlineCallbacks, ensureDeferred import mock @@ -353,28 +352,28 @@ class TestSendCommand(unittest.TestCase): Foo Bar Baz """) - @inlineCallbacks - def test_get_account_by_address_with_str(self): + @utilities.async_test + async def test_get_account_by_address_with_str(self): cmd = envelope.SendCommand(mail=self.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 ensureDeferred(cmd.apply(mock.Mock())) + await cmd.apply(mock.Mock()) get_account_by_address.assert_called_once_with('foo@example.com', return_default=True) # check that the apply did run through till the end. account.send_mail.assert_called_once_with(self.mail) - @inlineCallbacks - def test_get_account_by_address_with_email_message(self): + @utilities.async_test + 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() with mock.patch( 'alot.commands.envelope.settings.get_account_by_address', mock.Mock(return_value=account)) as get_account_by_address: - yield ensureDeferred(cmd.apply(mock.Mock())) + await cmd.apply(mock.Mock()) get_account_by_address.assert_called_once_with('foo@example.com', return_default=True) # check that the apply did run through till the end. |