summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-02-06 14:15:56 +0100
committerAnton Khirnov <anton@khirnov.net>2020-02-06 17:11:05 +0100
commitfbdde65a7f5eab74d2334481cee52ba429910c22 (patch)
tree736fcada5039b05a729f92695bf8c37c0a67872f /tests
parentaf713c2fad332f74c8b37d07e3c58bda979b2a4d (diff)
db/message: forbid instantiating Message with thread = None
It should always be instantiated from a Thread instance.
Diffstat (limited to 'tests')
-rw-r--r--tests/db/test_message.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/db/test_message.py b/tests/db/test_message.py
index adc099f6..953d0fe4 100644
--- a/tests/db/test_message.py
+++ b/tests/db/test_message.py
@@ -65,7 +65,8 @@ class TestMessage(unittest.TestCase):
email address is provided.
"""
msg = message.Message(mock.Mock(),
- MockNotmuchMessage({'From': 'user@example.com'}))
+ MockNotmuchMessage({'From': 'user@example.com'}),
+ mock.Mock())
self.assertEqual(msg.get_author(), ('', 'user@example.com'))
def test_get_author_name_and_email(self):
@@ -74,7 +75,8 @@ class TestMessage(unittest.TestCase):
"""
msg = message.Message(
mock.Mock(),
- MockNotmuchMessage({'From': '"User Name" <user@example.com>'}))
+ MockNotmuchMessage({'From': '"User Name" <user@example.com>'}),
+ mock.Mock())
self.assertEqual(msg.get_author(), ('User Name', 'user@example.com'))
def test_get_author_sender(self):
@@ -83,7 +85,8 @@ class TestMessage(unittest.TestCase):
"""
msg = message.Message(
mock.Mock(),
- MockNotmuchMessage({'Sender': '"User Name" <user@example.com>'}))
+ MockNotmuchMessage({'Sender': '"User Name" <user@example.com>'}),
+ mock.Mock())
self.assertEqual(msg.get_author(), ('User Name', 'user@example.com'))
def test_get_author_no_name_draft(self):
@@ -96,7 +99,7 @@ class TestMessage(unittest.TestCase):
with mock.patch('alot.db.message.settings.get_accounts',
mock.Mock(return_value=[acc])):
msg = message.Message(
- mock.Mock(), MockNotmuchMessage(tags=['draft']))
+ mock.Mock(), MockNotmuchMessage(tags=['draft']), mock.Mock())
self.assertEqual(msg.get_author(), ('User Name', 'user@example.com'))
def test_get_author_no_name(self):
@@ -108,5 +111,5 @@ class TestMessage(unittest.TestCase):
acc.realname = 'User Name'
with mock.patch('alot.db.message.settings.get_accounts',
mock.Mock(return_value=[acc])):
- msg = message.Message(mock.Mock(), MockNotmuchMessage())
+ msg = message.Message(mock.Mock(), MockNotmuchMessage(), mock.Mock())
self.assertEqual(msg.get_author(), ('Unknown', ''))