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