本文整理汇总了Python中fuglu.shared.Suspect.get_message_rep方法的典型用法代码示例。如果您正苦于以下问题:Python Suspect.get_message_rep方法的具体用法?Python Suspect.get_message_rep怎么用?Python Suspect.get_message_rep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuglu.shared.Suspect
的用法示例。
在下文中一共展示了Suspect.get_message_rep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_modified_message
# 需要导入模块: from fuglu.shared import Suspect [as 别名]
# 或者: from fuglu.shared.Suspect import get_message_rep [as 别名]
def test_modified_message(self):
"""Test if the modified message gets archived correctly"""
from fuglu.shared import Suspect
import shutil
import tempfile
tempfilename = tempfile.mktemp(
suffix='archive', prefix='fuglu-unittest', dir='/tmp')
shutil.copy(TESTDATADIR + '/helloworld.eml', tempfilename)
self.tempfiles.append(tempfilename)
self.config.set('ArchivePlugin', 'storeoriginal', '0')
candidate = ArchivePlugin(self.config)
suspect = Suspect(
'[email protected]', '[email protected]', tempfilename)
origmessage = suspect.get_source()
# modify the mesg
msgrep = suspect.get_message_rep()
msgrep['X-Changed-Something'] = 'Yes'
suspect.setMessageRep(msgrep)
filename = candidate.archive(suspect)
self.assertTrue(filename != None and filename)
self.tempfiles.append(filename)
archivedmessage = open(filename, 'r').read()
self.assertNotEqual(origmessage.strip(), archivedmessage.strip(
)), 'Archived message should have stored modified message'