summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2018-08-15 16:48:11 +0200
committerLucas Hoffmann <l-m-h@web.de>2018-08-16 07:12:16 +0200
commitc42dd604ada8dba42eb3c6c8306ecea5ba1a58bb (patch)
tree5e2da5142ff1c600bc8c7e7ebc7621a5af61392a /tests
parent536f39b0586e1a117f7d7580ae3609865b76d4f9 (diff)
Add a simple test for the send_mail function
This is just a simple test for the bug reported in #1303. The interesting test is marked as a known failure.
Diffstat (limited to 'tests')
-rw-r--r--tests/account_test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/account_test.py b/tests/account_test.py
index 99df9632..d78ebb13 100644
--- a/tests/account_test.py
+++ b/tests/account_test.py
@@ -19,6 +19,7 @@ import unittest
from alot import account
+from . import utilities
class _AccountTestClass(account.Account):
"""Implements stubs for ABC methods."""
@@ -155,3 +156,21 @@ class TestAddress(unittest.TestCase):
def test_cmp_empty(self):
addr = account.Address('user', 'éxample.com')
self.assertNotEqual(addr, '')
+
+
+class TestSend(unittest.TestCase):
+
+ @utilities.async_test
+ async def test_logs_on_success(self):
+ a = account.SendmailAccount(address="test@alot.dev", cmd="true")
+ with self.assertLogs() as cm:
+ await a.send_mail("some text")
+ #self.assertIn(cm.output, "sent mail successfullya")
+ self.assertIn("INFO:root:sent mail successfully", cm.output)
+
+ @unittest.expectedFailure
+ @utilities.async_test
+ async def test_failing_sendmail_command_is_noticed(self):
+ a = account.SendmailAccount(address="test@alot.dev", cmd="false")
+ with self.assertRaises(account.SendingMailFailed):
+ await a.send_mail("some text")