7
0
gaore-common-sdk-go/services/stat/client_test.go

81 lines
1.5 KiB
Go
Raw Normal View History

2024-09-06 17:59:18 +08:00
package stat
import (
"fmt"
"testing"
)
func TestSyncGameServerList(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateSyncGameServerListReq("insertOrUpdate", []map[string]interface{}{
{
"id": 123564,
"channel_id": 12456,
"version_id": 1,
"game_id": 1,
"server_id": 1,
"game_sign": "test",
"name": "test",
"open_date": "2099-03-01",
"open_time": "12:00:00",
"remark": "",
"status": 1,
"if_tj": 1,
},
})
resp, err := client.SyncGameServerList(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Count)
}
2024-09-19 12:33:23 +08:00
func TestClient_SetUserNewGameAuth(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateSetUserNewGameAuthReq(map[string]string{
"game_sign": "qwldy",
"game_id": "7275",
})
resp, err := client.SetUserNewGameAuth(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data.Result)
}
// TestClient_GetAgentList 查询代理列表单元测试
func TestClient_GetAgentList(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateGetAgentListReq(map[string]string{
"agent_id": "4051,68017",
//"agent_id": "99",
})
resp, err := client.GetAgentList(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
// 断言 resp.Code = 1且 resp.Data 不空为正常
if resp.Code != 1 || len(resp.Data.List) == 0 {
t.Errorf("GetAgentList test failed")
} else {
t.Log("GetAgentList test passed")
}
}