Commit 2ec151b4 authored by vipwzw's avatar vipwzw

fix ticket rpc test

parent 1ec8e701
......@@ -5,10 +5,12 @@
package rpc
import (
"fmt"
"testing"
"time"
"github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common/version"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
......@@ -140,15 +142,17 @@ func TestRPC_CallTestNode(t *testing.T) {
Msg: []byte("123"),
}
api.On("IsSync").Return(ret, nil)
api.On("Version").Return(&types.VersionInfo{Chain33: version.GetVersion()}, nil)
api.On("Close").Return()
rpcCfg := mock33.GetCfg().RPC
jsonClient, err := jsonclient.NewJSONClient("http://" + rpcCfg.JrpcBindAddr + "/")
assert.Nil(t, err)
assert.NotNil(t, jsonClient)
var result = ""
var result types.VersionInfo
err = jsonClient.Call("Chain33.Version", nil, &result)
fmt.Println(err)
assert.Nil(t, err)
assert.Equal(t, "6.0.1", result)
assert.Equal(t, version.GetVersion(), result.Chain33)
var isSnyc bool
err = jsonClient.Call("Chain33.IsSync", &types.ReqNil{}, &isSnyc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment