示例#1
0
    def test_base64encode_field_to_xml(self):
        from wechatpy.fields import Base64EncodeField

        content = b"test"
        field = Base64EncodeField("Content")
        expected = "<Content><![CDATA[{content}]]></Content>".format(content=to_text(base64.b64encode(content)))
        self.assertEqual(expected, field.to_xml(content))
示例#2
0
class DeviceEventReply(BaseReply):
    type = 'device_event'
    event = StringField('Event')
    device_type = StringField('DeviceType')
    device_id = StringField('DeviceID')
    session_id = StringField('SessionID')
    content = Base64EncodeField('Content')
示例#3
0
class DeviceEventReply(BaseReply):
    type = "device_event"
    event = StringField("Event")
    device_type = StringField("DeviceType")
    device_id = StringField("DeviceID")
    session_id = StringField("SessionID")
    content = Base64EncodeField("Content")