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


Python LeapMailStore.add_mail方法代码示例

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


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

示例1: test_add_mail_with_special_chars

# 需要导入模块: from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore [as 别名]
# 或者: from pixelated.adapter.mailstore.leap_mailstore.LeapMailStore import add_mail [as 别名]
    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,代码行数:12,代码来源:test_leap_mailstore.py

示例2: test_add_mail

# 需要导入模块: from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore [as 别名]
# 或者: from pixelated.adapter.mailstore.leap_mailstore.LeapMailStore import add_mail [as 别名]
    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,代码行数:13,代码来源:test_leap_mailstore.py

示例3: test_add_mail_with_inline_attachment

# 需要导入模块: from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore [as 别名]
# 或者: from pixelated.adapter.mailstore.leap_mailstore.LeapMailStore import add_mail [as 别名]
    def test_add_mail_with_inline_attachment(self):
        input_mail = MIMEMultipart()
        input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))
        attachment = MIMEApplication('pretend to be an inline attachment')
        attachment.add_header('Content-Disposition', 'u\'inline;\n\tfilename=super_nice_photo.jpg')
        input_mail.attach(attachment)
        mocked_message = self._add_create_mail_mocks_to_soledad(input_mail)
        store = LeapMailStore(self.soledad)

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

        expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'super_nice_photo.jpg', 'encoding': 'base64', 'size': 48, 'content-type': 'application/octet-stream'}]
        self.assertEqual(expected, message.as_dict()['attachments'])
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:15,代码来源:test_leap_mailstore.py

示例4: test_add_mail_with_attachment

# 需要导入模块: from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore [as 别名]
# 或者: from pixelated.adapter.mailstore.leap_mailstore.LeapMailStore import add_mail [as 别名]
    def test_add_mail_with_attachment(self):
        input_mail = MIMEMultipart()
        input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))
        attachment = MIMEApplication('pretend to be binary attachment data')
        attachment.add_header('Content-Disposition', 'attachment', filename='filename.txt')
        input_mail.attach(attachment)
        mocked_message = self._add_create_mail_mocks_to_soledad(input_mail)
        store = LeapMailStore(self.soledad)

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

        expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64'}]
        self.assertEqual(expected, message.as_dict()['attachments'])
开发者ID:phazel,项目名称:pixelated-user-agent,代码行数:15,代码来源:test_leap_mailstore.py


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