Browse Source

add test function

Jerry 7 years ago
parent
commit
61c4aef68c
1 changed files with 12 additions and 0 deletions
  1. 12 0
      wechat_client_test.go

+ 12 - 0
wechat_client_test.go

@@ -274,3 +274,15 @@ func TestMd5(t *testing.T) {
 	upper := strings.ToUpper(hex.EncodeToString(sum))
 	fmt.Println(" ssad  ", upper)
 }
+
+func TestGetWeChatUserId(t *testing.T) {
+	userIdRsp, err := GetWeChatUserId(appID, secretKey, "")
+	if err != nil {
+		fmt.Println("err:", err)
+		return
+	}
+	fmt.Println("OpenID:", userIdRsp.Openid)
+	fmt.Println("UnionID:", userIdRsp.Unionid)
+	fmt.Println("SessionKey:", userIdRsp.SessionKey)
+
+}