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


Python LeapMailStore._extract_attachment_info_from方法代码示例

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


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

示例1: test_extract_attachment_filename_with_or_without_quotes

# 需要导入模块: from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore [as 别名]
# 或者: from pixelated.adapter.mailstore.leap_mailstore.LeapMailStore import _extract_attachment_info_from [as 别名]
    def test_extract_attachment_filename_with_or_without_quotes(self):
        input_mail = MIMEMultipart()
        input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))

        attachment_without_quotes = MIMEApplication('pretend to be an attachment from apple mail')
        attachment_without_quotes.add_header('Content-Disposition', 'u\'attachment;\n\tfilename=batatinha.rtf')
        input_mail.attach(attachment_without_quotes)

        attachment_with_quotes = MIMEApplication('pretend to be an attachment from thunderbird')
        attachment_with_quotes.add_header('Content-Disposition', 'u\'attachment; filename="receipt.pdf"')
        input_mail.attach(attachment_with_quotes)

        message = self._add_create_mail_mocks_to_soledad(input_mail)
        store = LeapMailStore(self.soledad)
        attachment_info = store._extract_attachment_info_from(message)

        self.assertEqual('batatinha.rtf', attachment_info[0].name)
        self.assertEqual('receipt.pdf', attachment_info[1].name)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:20,代码来源:test_leap_mailstore.py

示例2: test_extract_attachment_filename_from_other_headers

# 需要导入模块: from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore [as 别名]
# 或者: from pixelated.adapter.mailstore.leap_mailstore.LeapMailStore import _extract_attachment_info_from [as 别名]
    def test_extract_attachment_filename_from_other_headers(self):
        input_mail = MIMEMultipart()
        input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))

        attachment_without_description = MIMEApplication('pretend to be an attachment from apple mail', _subtype='pgp-keys')
        attachment_without_description.add_header('Content-Disposition', 'attachment')
        attachment_without_description.add_header('Content-Description', 'Some GPG Key')

        input_mail.attach(attachment_without_description)

        attachment_with_name_in_content_type = MIMEApplication('pretend to be an attachment from thunderbird', _subtype='pgp-signature; name="signature.asc"')
        attachment_with_name_in_content_type.add_header('Content-Disposition', 'inline')
        input_mail.attach(attachment_with_name_in_content_type)

        message = self._add_create_mail_mocks_to_soledad(input_mail)
        store = LeapMailStore(self.soledad)
        attachment_info = store._extract_attachment_info_from(message)

        self.assertEqual('Some GPG Key', attachment_info[0].name)
        self.assertEqual('signature.asc', attachment_info[1].name)
开发者ID:bwagnerr,项目名称:pixelated-user-agent,代码行数:22,代码来源:test_leap_mailstore.py


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