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) } 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") } }