cosmos-sdk/tests/integration/gov/module_test.go
Facundo Medica af3122aa6c
feat!: Provide logger through depinject (#15818)
Co-authored-by: Julien Robert <julien@rbrt.fr>
2023-04-24 09:42:55 +00:00

43 lines
1.2 KiB
Go

package gov_test
import (
"testing"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/gov/types"
_ "github.com/cosmos/cosmos-sdk/x/mint"
)
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
var accountKeeper authkeeper.AccountKeeper
app, err := simtestutil.SetupAtGenesis(
depinject.Configs(
configurator.NewAppConfig(
configurator.ParamsModule(),
configurator.AuthModule(),
configurator.StakingModule(),
configurator.BankModule(),
configurator.GovModule(),
configurator.DistributionModule(),
configurator.ConsensusModule(),
),
depinject.Supply(log.NewNopLogger()),
),
&accountKeeper,
)
assert.NilError(t, err)
ctx := app.BaseApp.NewContext(false, cmtproto.Header{})
acc := accountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.ModuleName))
assert.Assert(t, acc != nil)
}