From 48dac1d9089ce2a36c55dc4768b24293d1257a37 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 6 Feb 2020 17:08:00 +0100 Subject: 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. --- tests/db/test_message.py | 10 +++++----- tests/db/test_thread.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'tests') 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" '}), - 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" '}), - 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()), ]) -- cgit v1.2.3