本文整理汇总了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)
示例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)