add check balance method to TestApp

This commit is contained in:
rhuairahrighairigh 2019-12-05 13:51:46 +00:00
parent 2d73e62773
commit 4662123105

View File

@ -2,6 +2,9 @@ package app
import (
"math/rand"
"testing"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
@ -107,6 +110,11 @@ func (tApp TestApp) InitializeFromGenesisStates(genesisStates ...GenesisState) T
return tApp
}
func (tApp TestApp) CheckBalance(t *testing.T, ctx sdk.Context, owner sdk.AccAddress, expectedCoins sdk.Coins) {
actualCoins := tApp.GetAccountKeeper().GetAccount(ctx, owner).GetCoins()
require.Equal(t, expectedCoins, actualCoins)
}
// GeneratePrivKeyAddressPairsFromRand generates (deterministically) a total of n private keys and addresses.
// TODO only generate secp256 keys?
func GeneratePrivKeyAddressPairs(n int) (keys []crypto.PrivKey, addrs []sdk.AccAddress) {