diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-02-06 17:08:00 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-02-06 17:11:05 +0100 |
commit | 48dac1d9089ce2a36c55dc4768b24293d1257a37 (patch) | |
tree | cf4e0c5751da8e7689269ea88b180b4dee3c3002 /tests | |
parent | 72ed7d40ac68d7e91f41e94fbcf6cb7a3e28433a (diff) |
db: rewrite the API for representing message trees
It should be cleaner and easier to use, and eventually replace the
custom tree walker in the thread display buffer.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/db/test_message.py | 10 | ||||
-rw-r--r-- | tests/db/test_thread.py | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/db/test_message.py b/tests/db/test_message.py index 953d0fe4..43b06e19 100644 --- a/tests/db/test_message.py +++ b/tests/db/test_message.py @@ -66,7 +66,7 @@ class TestMessage(unittest.TestCase): """ msg = message.Message(mock.Mock(), MockNotmuchMessage({'From': 'user@example.com'}), - mock.Mock()) + mock.Mock(), mock.Mock()) self.assertEqual(msg.get_author(), ('', 'user@example.com')) def test_get_author_name_and_email(self): @@ -76,7 +76,7 @@ class TestMessage(unittest.TestCase): msg = message.Message( mock.Mock(), MockNotmuchMessage({'From': '"User Name" <user@example.com>'}), - mock.Mock()) + mock.Mock(), mock.Mock()) self.assertEqual(msg.get_author(), ('User Name', 'user@example.com')) def test_get_author_sender(self): @@ -86,7 +86,7 @@ class TestMessage(unittest.TestCase): msg = message.Message( mock.Mock(), MockNotmuchMessage({'Sender': '"User Name" <user@example.com>'}), - mock.Mock()) + mock.Mock(), mock.Mock()) self.assertEqual(msg.get_author(), ('User Name', 'user@example.com')) def test_get_author_no_name_draft(self): @@ -99,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()) + mock.Mock(), MockNotmuchMessage(tags=['draft']), mock.Mock(), mock.Mock()) self.assertEqual(msg.get_author(), ('User Name', 'user@example.com')) def test_get_author_no_name(self): @@ -111,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(), mock.Mock()) + msg = message.Message(mock.Mock(), MockNotmuchMessage(), mock.Mock(), mock.Mock()) self.assertEqual(msg.get_author(), ('Unknown', '')) diff --git a/tests/db/test_thread.py b/tests/db/test_thread.py index 8c78a026..8b43b0b9 100644 --- a/tests/db/test_thread.py +++ b/tests/db/test_thread.py @@ -38,15 +38,15 @@ class TestThreadGetAuthor(unittest.TestCase): minute=10)), ('ooh', None)]: m = mock.Mock() - m.get_date = mock.Mock(return_value=d) + m.date = d m.get_author = mock.Mock(return_value=a) get_messages.append(m) gm = mock.Mock() - gm.keys = mock.Mock(return_value=get_messages) + gm.values = mock.Mock(return_value=get_messages) cls.__patchers.extend([ - mock.patch('alot.db.thread.Thread.get_messages', - new=mock.Mock(return_value=gm)), + mock.patch('alot.db.thread.Thread.messages', + new=mock.Mock(return_value=get_messages)), mock.patch('alot.db.thread.Thread.refresh', new=mock.Mock()), ]) |