Browse Source

rpc: fix tests

pull/703/head
Ethan Buchman 7 years ago
parent
commit
2e76b23c9a
2 changed files with 9 additions and 25 deletions
  1. +1
    -3
      rpc/client/mock/abci_test.go
  2. +8
    -22
      rpc/lib/rpc_test.go

+ 1
- 3
rpc/client/mock/abci_test.go View File

@ -96,10 +96,8 @@ func TestABCIRecorder(t *testing.T) {
_, err := r.ABCIInfo()
assert.Nil(err, "expected no err on info")
_, err = r.ABCIInfo()
assert.Nil(err, "expected no err on info")
_, err := r.ABCIQueryWithOptions("path", data.Bytes("data"), client.ABCIQueryOptions{Trusted: false})
_, err = r.ABCIQueryWithOptions("path", data.Bytes("data"), client.ABCIQueryOptions{Trusted: false})
assert.NotNil(err, "expected error on query")
require.Equal(2, len(r.Calls))


+ 8
- 22
rpc/lib/rpc_test.go View File

@ -318,19 +318,12 @@ func TestWSNewWSRPCFunc(t *testing.T) {
err = cl.Call(context.Background(), "echo_ws", params)
require.Nil(t, err)
select {
case msg := <-cl.ResponsesCh:
if msg.Error != nil {
t.Fatal(err)
}
result := new(ResultEcho)
err = json.Unmarshal(msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
msg := <-cl.ResponsesCh
if msg.Error != nil {
t.Fatal(err)
}
result := new(ResultEcho)
err = json.Unmarshal(*msg.Result, result)
err = json.Unmarshal(msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
@ -348,19 +341,12 @@ func TestWSHandlesArrayParams(t *testing.T) {
err = cl.CallWithArrayParams(context.Background(), "echo_ws", params)
require.Nil(t, err)
select {
case msg := <-cl.ResponsesCh:
if msg.Error != nil {
t.Fatalf("%+v", err)
}
result := new(ResultEcho)
err = json.Unmarshal(msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
msg := <-cl.ResponsesCh
if msg.Error != nil {
t.Fatalf("%+v", err)
}
result := new(ResultEcho)
err = json.Unmarshal(*msg.Result, result)
err = json.Unmarshal(msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)


Loading…
Cancel
Save