| @@ -2,7 +2,6 @@ package main | |||
| import ( | |||
| "encoding/json" | |||
| "log" | |||
| "testing" | |||
| ) | |||
| @@ -29,7 +28,8 @@ func TestDecodeSubscribeJson(t *testing.T) { | |||
| }` | |||
| s := WechatUserInfo{} | |||
| err := json.Unmarshal([]byte(msg), &s) | |||
| log.Println(err) | |||
| AssertEqual(t, err, nil, "decode json should have no error") | |||
| AssertEqual(t, s.Avatar, "http://wx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/0", "Avatar not right") | |||
| AssertEqual(t, s.Subscribe, int32(1), "subscribe should =1") | |||
| AssertEqual(t, s.OpenID, "o6_bmjrPTlm6_2sgVt7hMZOPfL2M", "OpenID mismatch") | |||