summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@users.noreply.github.com>2018-08-16 14:20:39 +0200
committerGitHub <noreply@github.com>2018-08-16 14:20:39 +0200
commit5b00a4ecd30d21ceeebb16eefbed4c48cfe3ba4a (patch)
tree5e2da5142ff1c600bc8c7e7ebc7621a5af61392a
parent536f39b0586e1a117f7d7580ae3609865b76d4f9 (diff)
parentc42dd604ada8dba42eb3c6c8306ecea5ba1a58bb (diff)
Merge pull request #1305 from lucc/test-send-mail
Add simple tests for #1303
-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")