本文整理匯總了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'