Improve go-data json support in rpc

This commit is contained in:
Ethan Frey
2017-03-22 20:13:18 +01:00
committed by Ethan Buchman
parent 6a0217688f
commit 90abc61c56
13 changed files with 41 additions and 29 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/abci/example/dummy"
abci "github.com/tendermint/abci/types"
data "github.com/tendermint/go-data"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
@ -35,8 +36,8 @@ func TestABCIMock(t *testing.T) {
BroadcastCommit: mock.Call{
Args: goodTx,
Response: &ctypes.ResultBroadcastTxCommit{
CheckTx: &abci.ResponseCheckTx{Data: []byte("stand")},
DeliverTx: &abci.ResponseDeliverTx{Data: []byte("deliver")},
CheckTx: &abci.ResponseCheckTx{Data: data.Bytes("stand")},
DeliverTx: &abci.ResponseDeliverTx{Data: data.Bytes("deliver")},
},
Error: errors.New("bad tx"),
},
@ -91,7 +92,7 @@ func TestABCIRecorder(t *testing.T) {
require.Equal(0, len(r.Calls))
r.ABCIInfo()
r.ABCIQuery("path", []byte("data"), true)
r.ABCIQuery("path", data.Bytes("data"), true)
require.Equal(2, len(r.Calls))
info := r.Calls[0]
@ -163,7 +164,7 @@ func TestABCIApp(t *testing.T) {
assert.True(res.DeliverTx.Code.IsOK())
// check the key
qres, err := m.ABCIQuery("/key", []byte(key), false)
qres, err := m.ABCIQuery("/key", data.Bytes(key), false)
require.Nil(err)
assert.EqualValues(value, qres.Response.Value)
}