package okrpc import ( "encoding/json" "fmt" "github.com/stretchr/testify/assert" "testing" ) func TestSendRpcRequest(t *testing.T) { request := Request{ Class: "rpcLinker.SbxQitListService", Method: "executeChain", } request.Args = append(request.Args, "1") arg0 := make(map[string]interface{}) arg0["pagination"] = make(map[string]interface{}) arg0["pagination"].(map[string]interface{})["current"] = 1 arg0["pagination"].(map[string]interface{})["pageSize"] = 10 arg0["pagination"].(map[string]interface{})["returnAll"] = false request.Args = append(request.Args, arg0) resp, err := request.SendRpcRequest() assert.Nil(t, err) t.Log(resp) } func TestUnmarshal(t *testing.T) { str := `[{'pagination':{'returnAll':false,'current':1,'pageSize':10}},1]` var data []interface{} err := json.Unmarshal([]byte(str), &data) if err != nil { fmt.Println("JSON unmarshaling failed:", err) return } fmt.Printf("%#v\n", data) }