diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-07-24 12:06:59 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:28 +0200 |
commit | bf96b1077bdd777400a40fc2fe3acc83552d70de (patch) | |
tree | bbc2a35088e22172fb0b9ae93ec1c5295f79891e /service | |
parent | cda364d86469f79d52936dbfeb451e9809b66564 (diff) |
Added integration test for LeapMailStore.all_mails.
Diffstat (limited to 'service')
-rw-r--r-- | service/test/integration/test_leap_mailstore.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/service/test/integration/test_leap_mailstore.py b/service/test/integration/test_leap_mailstore.py index 0b292e93..f666b645 100644 --- a/service/test/integration/test_leap_mailstore.py +++ b/service/test/integration/test_leap_mailstore.py @@ -30,6 +30,7 @@ class LeapMailStoreTest(SoledadTestBase): super(LeapMailStoreTest, self).setUp() self.adaptor = SoledadMailAdaptor() self.mbox_uuid = str(uuid4()) + self.store = LeapMailStore(self.soledad) @defer.inlineCallbacks def test_get_mail_with_body(self): @@ -37,13 +38,21 @@ class LeapMailStoreTest(SoledadTestBase): mail_id = yield self._create_mail_in_soledad(mail) expected_mail_dict = {'body': u'Dignissimos ducimus veritatis. Est tenetur consequatur quia occaecati. Vel sit sit voluptas.\n\nEarum distinctio eos. Accusantium qui sint ut quia assumenda. Facere dignissimos inventore autem sit amet. Pariatur voluptatem sint est.\n\nUt recusandae praesentium aspernatur. Exercitationem amet placeat deserunt quae consequatur eum. Unde doloremque suscipit quia.\n\n', 'header': {u'date': u'Tue, 21 Apr 2015 08:43:27 +0000 (UTC)', u'to': u'carmel@murazikortiz.name', u'x-tw-pixelated-tags': u'nite, macro, trash', u'from': u'darby.senger@zemlak.biz', u'subject': u'Itaque consequatur repellendus provident sunt quia.'}, 'ident': mail_id, 'tags': set([])} - store = LeapMailStore(self.soledad) - - result = yield store.get_mail(mail_id, include_body=True) + result = yield self.store.get_mail(mail_id, include_body=True) self.assertIsNotNone(result) self.assertEqual(expected_mail_dict, result.as_dict()) @defer.inlineCallbacks + def test_all_mails(self): + mail = _load_mail_from_file('mbox00000000') + yield self._create_mail_in_soledad(mail) + + mails = yield self.store.all_mails() + + self.assertEqual(1, len(mails)) + self.assertEqual('Itaque consequatur repellendus provident sunt quia.', mails[0].subject) + + @defer.inlineCallbacks def _create_mail_in_soledad(self, mail): message = self._convert_mail_to_leap_message(mail) yield self.adaptor.initialize_store(self.soledad) |