test LoadGenesis and change format

This commit is contained in:
Ethan Frey
2017-02-25 00:12:15 +01:00
parent 1fd2d17cd9
commit a6f62023b2
9 changed files with 130 additions and 64 deletions
+8 -4
View File
@@ -1,9 +1,11 @@
package counter
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/abci/types"
"github.com/tendermint/basecoin/app"
"github.com/tendermint/basecoin/types"
@@ -19,7 +21,7 @@ func TestCounterPlugin(t *testing.T) {
chainID := "test_chain_id"
bcApp := app.NewBasecoin(eyesCli)
bcApp.SetOption("base/chainID", chainID)
t.Log(bcApp.Info())
// t.Log(bcApp.Info())
// Add Counter plugin
counterPlugin := New()
@@ -31,7 +33,9 @@ func TestCounterPlugin(t *testing.T) {
// Seed Basecoin with account
test1Acc := test1PrivAcc.Account
test1Acc.Balance = types.Coins{{"", 1000}, {"gold", 1000}}
bcApp.SetOption("base/account", string(wire.JSONBytes(test1Acc)))
accOpt, err := json.Marshal(test1Acc)
require.Nil(t, err)
bcApp.SetOption("base/account", string(accOpt))
// Deliver a CounterTx
DeliverCounterTx := func(gas int64, fee types.Coin, inputCoins types.Coins, inputSequence int, appFee types.Coins) abci.Result {
@@ -46,10 +50,10 @@ func TestCounterPlugin(t *testing.T) {
// Sign request
signBytes := tx.SignBytes(chainID)
t.Logf("Sign bytes: %X\n", signBytes)
// t.Logf("Sign bytes: %X\n", signBytes)
sig := test1PrivAcc.Sign(signBytes)
tx.Input.Signature = crypto.SignatureS{sig}
t.Logf("Signed TX bytes: %X\n", wire.BinaryBytes(struct{ types.Tx }{tx}))
// t.Logf("Signed TX bytes: %X\n", wire.BinaryBytes(struct{ types.Tx }{tx}))
// Write request
txBytes := wire.BinaryBytes(struct{ types.Tx }{tx})