test: remove api that should not be used (#15678)

This commit is contained in:
Julien Robert
2023-04-03 21:57:11 +00:00
committed by GitHub
parent 5e90819765
commit c3b1b37e49
6 changed files with 37 additions and 46 deletions
@@ -8,10 +8,10 @@ import (
"cosmossdk.io/simapp"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdktestutil "github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
"github.com/cosmos/cosmos-sdk/x/staking"
@@ -137,7 +137,7 @@ func TestInitGenesis_PoolsBalanceMismatch(t *testing.T) {
BondDenom: "stake",
}
sdktestutil.AssertPanics(t, func() {
require.Panics(t, func() {
// setting validator status to bonded so the balance counts towards bonded pool
validator.Status = types.Bonded
app.StakingKeeper.InitGenesis(ctx, &types.GenesisState{
@@ -148,7 +148,7 @@ func TestInitGenesis_PoolsBalanceMismatch(t *testing.T) {
// "should panic because bonded pool balance is different from bonded pool coins",
)
sdktestutil.AssertPanics(t, func() {
require.Panics(t, func() {
// setting validator status to unbonded so the balance counts towards not bonded pool
validator.Status = types.Unbonded
app.StakingKeeper.InitGenesis(ctx, &types.GenesisState{
@@ -7,9 +7,9 @@ import (
"cosmossdk.io/math"
"cosmossdk.io/simapp"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
sdktestutil "github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil"
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
@@ -382,7 +382,7 @@ func TestSlashWithRedelegation(t *testing.T) {
_, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
assert.Assert(t, found)
sdktestutil.AssertNotPanics(t, func() {
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction)
})
burnAmount := sdk.NewDecFromInt(app.StakingKeeper.TokensFromConsensusPower(ctx, 10)).Mul(fraction).TruncateInt()
@@ -415,7 +415,7 @@ func TestSlashWithRedelegation(t *testing.T) {
_, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
assert.Assert(t, found)
sdktestutil.AssertNotPanics(t, func() {
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec())
})
burnAmount = app.StakingKeeper.TokensFromConsensusPower(ctx, 7)
@@ -451,7 +451,7 @@ func TestSlashWithRedelegation(t *testing.T) {
_, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
assert.Assert(t, found)
sdktestutil.AssertNotPanics(t, func() {
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec())
})
@@ -486,7 +486,7 @@ func TestSlashWithRedelegation(t *testing.T) {
validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
assert.Equal(t, validator.GetStatus(), types.Unbonding)
sdktestutil.AssertNotPanics(t, func() {
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec())
})