当前位置: 首页>>代码示例>>Python>>正文


Python leap_mailstore.LeapMailStore类代码示例

本文整理汇总了Python中pixelated.adapter.mailstore.leap_mailstore.LeapMailStore的典型用法代码示例。如果您正苦于以下问题:Python LeapMailStore类的具体用法?Python LeapMailStore怎么用?Python LeapMailStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LeapMailStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_mailbox_names

    def test_get_mailbox_names(self):
        self._mock_get_mailbox('OTHER', create_new_uuid=True)
        store = LeapMailStore(self.soledad)

        names = yield store.get_mailbox_names()

        self.assertEqual({'INBOX', 'OTHER'}, names)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:7,代码来源:test_leap_mailstore.py

示例2: test_get_mail_not_exist

    def test_get_mail_not_exist(self):
        when(self.soledad).get_doc(ANY()).thenAnswer(lambda: defer.succeed(None))
        store = LeapMailStore(self.soledad)

        mail = yield store.get_mail(_format_mdoc_id(uuid4(), 1))

        self.assertIsNone(mail)
开发者ID:Josue23,项目名称:pixelated-user-agent,代码行数:7,代码来源:test_leap_mailstore.py

示例3: test_delete_mail

    def test_delete_mail(self):
        mdoc_id, fdoc_id = self._add_mail_fixture_to_soledad_from_file('mbox00000000')

        store = LeapMailStore(self.soledad)

        yield store.delete_mail(mdoc_id)

        self._assert_mail_got_deleted(fdoc_id, mdoc_id)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:8,代码来源:test_leap_mailstore.py

示例4: test_delete_mailbox

    def test_delete_mailbox(self):
        _, mbox_soledad_doc = self._mock_get_mailbox('INBOX')
        store = LeapMailStore(self.soledad)
        when(self.soledad).delete_doc(mbox_soledad_doc).thenReturn(defer.succeed(None))

        yield store.delete_mailbox('INBOX')

        verify(self.soledad).delete_doc(self.doc_by_id[mbox_soledad_doc.doc_id])
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:8,代码来源:test_leap_mailstore.py

示例5: test_get_mails_fails_for_invalid_mail_id

    def test_get_mails_fails_for_invalid_mail_id(self):
        store = LeapMailStore(self.soledad)

        try:
            yield store.get_mails(['invalid'])
            self.fail('Exception expected')
        except Exception, e:
            pass
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:8,代码来源:test_leap_mailstore.py

示例6: test_get_mail_not_exist

    def test_get_mail_not_exist(self):
        with patch('mockito.invocation.AnswerSelector', AnswerSelector):
            when(self.soledad).get_doc(ANY()).thenAnswer(lambda: defer.succeed(None))
        store = LeapMailStore(self.soledad)

        mail = yield store.get_mail(_format_mdoc_id(uuid4(), 1))

        self.assertIsNone(mail)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:8,代码来源:test_leap_mailstore.py

示例7: test_copy_mail_to_mailbox

    def test_copy_mail_to_mailbox(self):
        expected_message = self._add_create_mail_mocks_to_soledad_from_fixture_file('mbox00000000')
        mail_id, fdoc_id = self._add_mail_fixture_to_soledad_from_file('mbox00000000')
        self._mock_get_mailbox('TRASH')
        store = LeapMailStore(self.soledad)

        mail = yield store.copy_mail_to_mailbox(mail_id, 'TRASH')

        self._assert_message_docs_created(expected_message, mail, only_mdoc_and_fdoc=True)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:9,代码来源:test_leap_mailstore.py

示例8: test_get_mail_with_body

    def test_get_mail_with_body(self):
        expeted_body = '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'
        mdoc_id, _ = self._add_mail_fixture_to_soledad_from_file('mbox00000000')

        store = LeapMailStore(self.soledad)

        mail = yield store.get_mail(mdoc_id, include_body=True)

        self.assertEqual(expeted_body, mail.body)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:9,代码来源:test_leap_mailstore.py

示例9: test_all_mail_graceful_error_handling

    def test_all_mail_graceful_error_handling(self):
        mail_id, fdoc_id = self._add_mail_fixture_to_soledad_from_file('mbox00000000')
        when(self.soledad).get_from_index('by-type', 'meta').thenReturn(defer.succeed([self.doc_by_id[mail_id]]))
        when(self.soledad).get_doc(self.doc_by_id[mail_id].content['cdocs'][0]).thenAnswer(lambda: defer.fail(Exception('fail loading attachment')))
        store = LeapMailStore(self.soledad)

        mails = yield store.all_mails(gracefully_ignore_errors=True)

        self.assertEqual(0, len(mails))
开发者ID:Josue23,项目名称:pixelated-user-agent,代码行数:9,代码来源:test_leap_mailstore.py

示例10: test_get_mail_from_mailbox

    def test_get_mail_from_mailbox(self):
        other, _ = self._mock_get_mailbox('OTHER', create_new_uuid=True)
        mdoc_id, _ = self._add_mail_fixture_to_soledad_from_file('mbox00000000', other.uuid)

        store = LeapMailStore(self.soledad)

        mail = yield store.get_mail(mdoc_id)

        self.assertEqual('OTHER', mail.mailbox_name)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:9,代码来源:test_leap_mailstore.py

示例11: test_get_mail_attachment_throws_exception_if_attachment_does_not_exist

 def test_get_mail_attachment_throws_exception_if_attachment_does_not_exist(self):
     attachment_id = '1B0A9AAD9E153D24265395203C53884506ABA276394B9FEC02B214BF9E77E48E'
     when(self.soledad).get_from_index('by-type-and-payloadhash', 'cnt', attachment_id).thenReturn(defer.succeed([]))
     store = LeapMailStore(self.soledad)
     try:
         yield store.get_mail_attachment(attachment_id)
         self.fail('ValueError exception expected')
     except ValueError:
         pass
开发者ID:phazel,项目名称:pixelated-user-agent,代码行数:9,代码来源:test_leap_mailstore.py

示例12: test_get_mail_attachment

    def test_get_mail_attachment(self):
        attachment_id = 'AAAA9AAD9E153D24265395203C53884506ABA276394B9FEC02B214BF9E77E48E'
        doc = SoledadDocument(json=json.dumps({'content_type': 'foo/bar', 'raw': 'asdf'}))
        when(self.soledad).get_from_index('by-type-and-payloadhash', 'cnt', attachment_id).thenReturn(defer.succeed([doc]))
        store = LeapMailStore(self.soledad)

        attachment = yield store.get_mail_attachment(attachment_id)

        self.assertEqual({'content-type': 'foo/bar', 'content': bytearray('asdf')}, attachment)
开发者ID:phazel,项目名称:pixelated-user-agent,代码行数:9,代码来源:test_leap_mailstore.py

示例13: test_get_mailbox_mail_ids

    def test_get_mailbox_mail_ids(self):
        mdoc_id, fdoc_id = self._add_mail_fixture_to_soledad_from_file('mbox00000000')
        when(self.soledad).get_from_index('by-type-and-mbox-uuid', 'flags', underscore_uuid(self.mbox_uuid)).thenReturn(defer.succeed([self.doc_by_id[fdoc_id]]))
        self._mock_get_mailbox('INBOX')
        store = LeapMailStore(self.soledad)

        mail_ids = yield store.get_mailbox_mail_ids('INBOX')

        self.assertEqual(1, len(mail_ids))
        self.assertEqual(mdoc_id, mail_ids[0])
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:10,代码来源:test_leap_mailstore.py

示例14: test_add_mail_with_special_chars

    def test_add_mail_with_special_chars(self):
        input_mail = MIMEText(u'a utf8 message', _charset='utf-8')
        input_mail['From'] = Header(u'"Älbert Übrö" <äüö@example.mail>', 'iso-8859-1')
        input_mail['Subject'] = Header(u'Hällö Wörld', 'iso-8859-1')
        self._add_create_mail_mocks_to_soledad(input_mail)
        store = LeapMailStore(self.soledad)

        message = yield store.add_mail('INBOX', input_mail.as_string())

        self.assertEqual(u'"\xc4lbert \xdcbr\xf6" <\xe4\xfc\[email protected]>', message.as_dict()['header']['from'])
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:10,代码来源:test_leap_mailstore.py

示例15: test_add_mail

    def test_add_mail(self):
        expected_message = self._add_create_mail_mocks_to_soledad_from_fixture_file('mbox00000000')
        mail = self._load_mail_from_file('mbox00000000')
        self._mock_get_mailbox('INBOX')

        store = LeapMailStore(self.soledad)

        message = yield store.add_mail('INBOX', mail.as_string())

        self.assertIsInstance(message, LeapMail)
        self._assert_message_docs_created(expected_message, message)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:11,代码来源:test_leap_mailstore.py


注:本文中的pixelated.adapter.mailstore.leap_mailstore.LeapMailStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。