本文整理匯總了Python中pystmark.Message.load_message方法的典型用法代碼示例。如果您正苦於以下問題:Python Message.load_message方法的具體用法?Python Message.load_message怎麽用?Python Message.load_message使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pystmark.Message
的用法示例。
在下文中一共展示了Message.load_message方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_load_message_postmark
# 需要導入模塊: from pystmark import Message [as 別名]
# 或者: from pystmark.Message import load_message [as 別名]
def test_load_message_postmark(self):
self.assertNotRaises(TypeError, Message.load_message,
self.message)
msg = Message.load_message(self.message)
self.assertNotRaises(MessageError, Message.load_message,
self.message, verify=True)
self.assertEqual(msg.data(), self.message)
示例2: test_load_message_native
# 需要導入模塊: from pystmark import Message [as 別名]
# 或者: from pystmark.Message import load_message [as 別名]
def test_load_message_native(self):
msg = dict(to='me', text='hi', html='<b>hi</b>', reply_to='you',
cc='dog,cat', subject='dogs', headers=[dict(Name='Food',
Value='7')])
self.assertNotRaises(TypeError, Message.load_message, msg)
self.assertNotRaises(MessageError, Message.load_message, msg,
verify=True)
msg = dict(to='me', text='hi')
self.assertNotRaises(TypeError, Message.load_message, msg)
self.assertNotRaises(MessageError, Message.load_message, msg,
verify=True)
pystmsg = Message.load_message(msg)
self.assertEqual(pystmsg.data(), dict(To='me', TextBody='hi'))
示例3: test_load_message_native
# 需要導入模塊: from pystmark import Message [as 別名]
# 或者: from pystmark.Message import load_message [as 別名]
def test_load_message_native(self):
msg = dict(to='me', text='hi', html='<b>hi</b>', reply_to='you',
cc='dog,cat', bcc='foo,bar', subject='dogs',
track_opens=True, headers=[dict(Name='Food', Value='7')],
attachments=[], sender='admin', tag='tag')
self.assertEqual(sorted(msg), sorted(Message._fields))
self.assertNotRaises(TypeError, Message.load_message, msg)
self.assertNotRaises(MessageError, Message.load_message, msg,
verify=True)
msg = dict(to='me', text='hi')
self.assertNotRaises(TypeError, Message.load_message, msg)
self.assertNotRaises(MessageError, Message.load_message, msg,
verify=True)
pystmsg = Message.load_message(msg)
self.assertEqual(pystmsg.data(), dict(To='me', TextBody='hi'))
示例4: test_load_invalid_message_some_data
# 需要導入模塊: from pystmark import Message [as 別名]
# 或者: from pystmark.Message import load_message [as 別名]
def test_load_invalid_message_some_data(self):
msg = Message.load_message(dict(to='me'))
self.assertRaises(MessageError, msg.verify)