Beispiel #1
0
def test_toxml():
    weixinhandler = Weixin(token='weixin-token')
    dic1 = {"name": "cloudaice", "age": 23}
    xml = weixinhandler._toxml(dic1)
    root = ET.fromstring("<xml>" + xml + "</xml>")
    params = dict()
    for elem in root:
        params[elem.tag] = elem.text
    if "age" in params:
        params["age"] = int(params["age"])
    assert_equal(params, dic1)
Beispiel #2
0
def test_toxml():
    weixinhandler = Weixin(token='weixin-token')
    dic1 = {"name": "cloudaice", "age": 23}
    xml = weixinhandler._toxml(dic1)
    root = ET.fromstring("<xml>" + xml + "</xml>")
    params = dict()
    for elem in root:
        params[elem.tag] = elem.text
    if "age" in params:
        params["age"] = int(params["age"])
    assert_equal(params, dic1)