This commit is contained in:
rigelrozanski 2018-02-14 14:23:47 +00:00 committed by Ethan Buchman
parent 890fadc8c3
commit 34ff225c31
3 changed files with 12 additions and 1 deletions

View File

@ -51,6 +51,11 @@ func (tapp *TestApp) RunBeginBlock() {
return
}
// kill resources used by basecapp
func (tapp *TestApp) Close() {
tapp.db.Close()
}
func (tapp *TestApp) ensureBeginBlock() {
if tapp.header == nil {
panic("TestApp.header was nil, call TestApp.RunBeginBlock()")

View File

@ -18,6 +18,7 @@ import (
func TestSendMsg(t *testing.T) {
tba := newTestBasecoinApp()
tba.RunBeginBlock()
defer tba.Close()
// Construct a SendMsg.
var msg = bank.SendMsg{
@ -43,8 +44,12 @@ func TestSendMsg(t *testing.T) {
// Run a Deliver on SendMsg.
res = tba.RunDeliverMsg(msg)
assert.Equal(t, sdk.CodeUnrecognizedAddress, res.Code, res.Log)
}
// TODO seperate this test, need a closer on db? keep getting resource unavailable
func TestGenesis(t *testing.T) {
tba := newTestBasecoinApp()
tba.RunBeginBlock()
defer tba.Close()
// construct some genesis bytes to reflect basecoin/types/AppAccount
pk := crypto.GenPrivKeyEd25519().PubKey()

View File

@ -4,6 +4,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
crypto "github.com/tendermint/go-crypto"
cmn "github.com/tendermint/tmlibs/common"
)
var _ sdk.Account = (*AppAccount)(nil)