108 lines
2.3 KiB
Go
108 lines
2.3 KiB
Go
//go:build integration
|
|
|
|
package rpc
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"testing"
|
|
|
|
pb "bsm/full/module/ec/delivery/external/pb/delivery"
|
|
)
|
|
|
|
func TestMemberAdd(t *testing.T) {
|
|
conn, ctx := GetCoon()
|
|
client := pb.NewMemberClient(conn)
|
|
|
|
defer conn.Close()
|
|
data := pb.MemberItem{
|
|
TeamIdentity: "f3b9bf81-c721-4d1e-9261-2b96d0fe0cc5",
|
|
Name: "小秦",
|
|
Phone: "18725312289",
|
|
Picture: "https://www.baidu.com/x.png",
|
|
}
|
|
re, _ := json.Marshal(&data)
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
res, err := client.MemberAdd(ctx, &data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
s, err := json.Marshal(res)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
}
|
|
func TestMemberSet(t *testing.T) {
|
|
conn, ctx := GetCoon()
|
|
client := pb.NewMemberClient(conn)
|
|
|
|
defer conn.Close()
|
|
data := pb.MemberItem{
|
|
Identity: "1e280531-8ffd-4cf8-b445-f37ce1807685",
|
|
TeamIdentity: "f3b9bf81-c721-4d1e-9261-2b96d0fe0cc5",
|
|
Name: "小秦",
|
|
Phone: "18725312289",
|
|
Picture: "https://www.baidu.com/xx.png",
|
|
Status: 1,
|
|
}
|
|
re, _ := json.Marshal(&data)
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
res, err := client.MemberSet(ctx, &data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
s, err := json.Marshal(res)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
}
|
|
func TestMemberGet(t *testing.T) {
|
|
conn, ctx := GetCoon()
|
|
client := pb.NewMemberClient(conn)
|
|
|
|
defer conn.Close()
|
|
data := pb.IdentRequest{
|
|
Identity: "1e280531-8ffd-4cf8-b445-f37ce1807685",
|
|
}
|
|
re, _ := json.Marshal(&data)
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
res, err := client.MemberGet(ctx, &data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
s, err := json.Marshal(res)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
}
|
|
func TestMemberList(t *testing.T) {
|
|
conn, ctx := GetCoon()
|
|
client := pb.NewMemberClient(conn)
|
|
|
|
defer conn.Close()
|
|
data := pb.FetchRequest{
|
|
PageNo: 1,
|
|
PageSize: 10,
|
|
Params: map[string]string{
|
|
"identity": "",
|
|
"team_identity": "",
|
|
"name": "秦",
|
|
"status": "",
|
|
},
|
|
}
|
|
re, _ := json.Marshal(&data)
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
res, err := client.MemberList(ctx, &data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
s, err := json.Marshal(res)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
}
|