Move integration test attmept to app/integration folder

This commit is contained in:
Ethan Frey
2020-01-21 09:04:38 +01:00
parent 29f1c3cccf
commit cce07ca01d
2 changed files with 16 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
package app
package integration
/**
This file is full of test helper functions, taken from simapp
@@ -13,6 +13,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
wasmd "github.com/cosmwasm/wasmd/app"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
@@ -27,14 +28,14 @@ const (
SimAppChainID = "wasmd-app"
)
// Setup initializes a new WasmApp. A Nop logger is set in WasmApp.
func Setup(isCheckTx bool) *WasmApp {
// Setup initializes a new wasmd.WasmApp. A Nop logger is set in WasmApp.
func Setup(isCheckTx bool) *wasmd.WasmApp {
db := dbm.NewMemDB()
app := NewWasmApp(log.NewNopLogger(), db, nil, true, 0)
// app := NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, 0)
app := wasmd.NewWasmApp(log.NewNopLogger(), db, nil, true, 0)
// app := wasmd.NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, 0)
if !isCheckTx {
// init chain must be called to stop deliverState from being nil
genesisState := NewDefaultGenesisState()
genesisState := wasmd.NewDefaultGenesisState()
stateBytes, err := codec.MarshalJSONIndent(app.Codec(), genesisState)
if err != nil {
panic(err)
@@ -52,15 +53,15 @@ func Setup(isCheckTx bool) *WasmApp {
return app
}
// SetupWithGenesisAccounts initializes a new WasmApp with the passed in
// SetupWithGenesisAccounts initializes a new wasmd.WasmApp with the passed in
// genesis accounts.
func SetupWithGenesisAccounts(genAccs []authexported.GenesisAccount) *WasmApp {
func SetupWithGenesisAccounts(genAccs []authexported.GenesisAccount) *wasmd.WasmApp {
db := dbm.NewMemDB()
app := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
// app := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0)
app := wasmd.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
// app := wasmd.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0)
// initialize the chain with the passed in genesis accounts
genesisState := NewDefaultGenesisState()
genesisState := wasmd.NewDefaultGenesisState()
authGenesis := auth.NewGenesisState(auth.DefaultParams(), genAccs)
genesisStateBz := app.Codec().MustMarshalJSON(authGenesis)
@@ -91,7 +92,7 @@ func SetupWithGenesisAccounts(genAccs []authexported.GenesisAccount) *WasmApp {
// the parameter 'expPass' against the result. A corresponding result is
// returned.
func SignAndDeliver(
t *testing.T, app *WasmApp, msgs []sdk.Msg,
t *testing.T, app *wasmd.WasmApp, msgs []sdk.Msg,
accNums, seq []uint64, expPass bool, priv ...crypto.PrivKey,
) sdk.Result {
// ) (sdk.GasInfo, *sdk.Result, error) {

View File

@@ -1,4 +1,4 @@
package keeper_test
package integration
import (
"encoding/binary"
@@ -27,7 +27,7 @@ func CreateTestApp(t *testing.T, accounts []*auth.BaseAccount) *app.WasmApp {
for i, acct := range accounts {
genAccounts[i] = acct
}
wasmd := app.SetupWithGenesisAccounts(genAccounts)
wasmd := SetupWithGenesisAccounts(genAccounts)
return wasmd
}
@@ -50,7 +50,7 @@ func TestSendWithApp(t *testing.T) {
}
func sign(t *testing.T, wasm *app.WasmApp, msg sdk.Msg, signer *signer, expectPass bool) sdk.Result {
res := app.SignAndDeliver(t, wasm, []sdk.Msg{msg}, []uint64{signer.acctNum}, []uint64{signer.seq}, expectPass, signer.priv)
res := SignAndDeliver(t, wasm, []sdk.Msg{msg}, []uint64{signer.acctNum}, []uint64{signer.seq}, expectPass, signer.priv)
signer.seq++
return res
}