Skip to content

Commit

Permalink
Merge pull request #1305 from lucc/test-send-mail
Browse files Browse the repository at this point in the history
Add simple tests for #1303
  • Loading branch information
lucc committed Aug 16, 2018
2 parents 536f39b + c42dd60 commit 5b00a4e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/account_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from alot import account

from . import utilities

class _AccountTestClass(account.Account):
"""Implements stubs for ABC methods."""
Expand Down Expand Up @@ -155,3 +156,21 @@ def test_domain_name_eq_unicode_sensitive(self):
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")

0 comments on commit 5b00a4e

Please sign in to comment.