2026-08-09 10:43:45 +08:00
|
|
|
//go:build integration
|
|
|
|
|
|
|
|
|
|
package rpc
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"fmt"
|
|
|
|
|
"testing"
|
|
|
|
|
|
2026-08-09 12:41:08 +08:00
|
|
|
pb "bsm/full/module/ec/delivery/external/pb/delivery"
|
2026-08-09 10:43:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestTeamAdd(t *testing.T) {
|
|
|
|
|
conn, ctx := GetCoon()
|
|
|
|
|
client := pb.NewTeamClient(conn)
|
|
|
|
|
|
|
|
|
|
defer conn.Close()
|
|
|
|
|
data := pb.TeamItem{
|
|
|
|
|
Title: "XX专送团队",
|
|
|
|
|
Owner: "B9355263-4983-5BAA-631A-046B453480C8",
|
|
|
|
|
Contacts: "老王",
|
|
|
|
|
Phone: "13402984328",
|
|
|
|
|
Logo: "http://www.baidu.com/sad.jpg",
|
|
|
|
|
}
|
|
|
|
|
re, _ := json.Marshal(&data)
|
|
|
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
|
|
|
res, err := client.TeamAdd(ctx, &data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
s, err := json.Marshal(res)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
|
|
|
}
|
|
|
|
|
func TestTeamSet(t *testing.T) {
|
|
|
|
|
conn, ctx := GetCoon()
|
|
|
|
|
client := pb.NewTeamClient(conn)
|
|
|
|
|
|
|
|
|
|
defer conn.Close()
|
|
|
|
|
data := pb.TeamItem{
|
|
|
|
|
Title: "XX专送团队",
|
|
|
|
|
Owner: "B9355263-4983-5BAA-631A-046B453480C8",
|
|
|
|
|
Contacts: "老李",
|
|
|
|
|
Phone: "13402984328",
|
|
|
|
|
Logo: "http://www.baidu.com/sad.jpg",
|
|
|
|
|
Identity: "f3b9bf81-c721-4d1e-9261-2b96d0fe0cc5",
|
|
|
|
|
Status: 1,
|
|
|
|
|
}
|
|
|
|
|
re, _ := json.Marshal(&data)
|
|
|
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
|
|
|
res, err := client.TeamSet(ctx, &data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
s, err := json.Marshal(res)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
|
|
|
}
|
|
|
|
|
func TestTeamGet(t *testing.T) {
|
|
|
|
|
conn, ctx := GetCoon()
|
|
|
|
|
client := pb.NewTeamClient(conn)
|
|
|
|
|
|
|
|
|
|
defer conn.Close()
|
|
|
|
|
data := pb.IdentRequest{
|
|
|
|
|
Identity: "f3b9bf81-c721-4d1e-9261-2b96d0fe0cc5",
|
|
|
|
|
}
|
|
|
|
|
re, _ := json.Marshal(&data)
|
|
|
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
|
|
|
res, err := client.TeamGet(ctx, &data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
s, err := json.Marshal(res)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
|
|
|
}
|
|
|
|
|
func TestTeamList(t *testing.T) {
|
|
|
|
|
conn, ctx := GetCoon()
|
|
|
|
|
client := pb.NewTeamClient(conn)
|
|
|
|
|
|
|
|
|
|
defer conn.Close()
|
|
|
|
|
data := pb.FetchRequest{
|
|
|
|
|
PageNo: 1,
|
|
|
|
|
PageSize: 10,
|
|
|
|
|
Params: map[string]string{
|
|
|
|
|
"identity": "",
|
|
|
|
|
"title": "",
|
|
|
|
|
"owner": "",
|
|
|
|
|
"status": "",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
re, _ := json.Marshal(&data)
|
|
|
|
|
fmt.Printf("发送的测试消息: %s\n", re)
|
|
|
|
|
res, err := client.TeamList(ctx, &data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
s, err := json.Marshal(res)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("返回的测试消息: %s", s)
|
|
|
|
|
}
|