summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2019-02-17 13:41:21 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2019-05-11 17:37:57 +0100
commit10c1c2cec85c767f345017915c2b017851e5fce2 (patch)
tree91a8c525a201012829dc23b6aae525f3dec6b549 /tests
parente4933f0eccc5d4afce26a9a6821e3edca562a894 (diff)
tests/commands/globals: Simplify signing tests
Diffstat (limited to 'tests')
-rw-r--r--tests/commands/test_global.py30
1 files changed, 6 insertions, 24 deletions
diff --git a/tests/commands/test_global.py b/tests/commands/test_global.py
index dad7412c..3d69bd04 100644
--- a/tests/commands/test_global.py
+++ b/tests/commands/test_global.py
@@ -55,50 +55,32 @@ class TestComposeCommand(unittest.TestCase):
account.signature = None
return account
- @utilities.async_test
- async def test_apply_sign_by_default_okay(self):
+ def test_apply_sign_by_default_okay(self):
envelope = self._make_envelope_mock()
envelope.account = self._make_account_mock()
cmd = g_commands.ComposeCommand(envelope=envelope)
- with mock.patch('alot.commands.globals.settings.get_addressbooks',
- mock.Mock(side_effect=Stop)):
- try:
- await cmd.apply(mock.Mock())
- except Stop:
- pass
+ cmd._set_gpg_sign(mock.Mock(), account)
self.assertTrue(envelope.sign)
self.assertIs(envelope.sign_key, mock.sentinel.gpg_key)
- @utilities.async_test
- async def test_apply_sign_by_default_false_doesnt_set_key(self):
+ def test_apply_sign_by_default_false_doesnt_set_key(self):
envelope = self._make_envelope_mock()
envelope.account = self._make_account_mock(sign_by_default=False)
cmd = g_commands.ComposeCommand(envelope=envelope)
- with mock.patch('alot.commands.globals.settings.get_addressbooks',
- mock.Mock(side_effect=Stop)):
- try:
- await cmd.apply(mock.Mock())
- except Stop:
- pass
+ cmd._set_gpg_sign(mock.Mock(), account)
self.assertFalse(envelope.sign)
self.assertIs(envelope.sign_key, None)
- @utilities.async_test
- async def test_apply_sign_by_default_but_no_key(self):
+ def test_apply_sign_by_default_but_no_key(self):
envelope = self._make_envelope_mock()
envelope.account = self._make_account_mock(gpg_key=None)
cmd = g_commands.ComposeCommand(envelope=envelope)
- with mock.patch('alot.commands.globals.settings.get_addressbooks',
- mock.Mock(side_effect=Stop)):
- try:
- await cmd.apply(mock.Mock())
- except Stop:
- pass
+ cmd._set_gpg_sign(mock.Mock(), account)
self.assertFalse(envelope.sign)
self.assertIs(envelope.sign_key, None)