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))
class DeviceEventReply(BaseReply): type = 'device_event' event = StringField('Event') device_type = StringField('DeviceType') device_id = StringField('DeviceID') session_id = StringField('SessionID') content = Base64EncodeField('Content')
class DeviceEventReply(BaseReply): type = "device_event" event = StringField("Event") device_type = StringField("DeviceType") device_id = StringField("DeviceID") session_id = StringField("SessionID") content = Base64EncodeField("Content")