migrate TestTallyOnlyValidators51Yes to use simapp
This commit is contained in:
parent
1cf4a7e330
commit
84b7fe5bfa
|
@ -10,29 +10,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||
)
|
||||
|
||||
func TestTallyOnlyValidators51Yes(t *testing.T) {
|
||||
ctx, _, _, keeper, sk, _ := createTestInput(t, false, 100)
|
||||
createValidators(ctx, sk, []int64{5, 6, 0})
|
||||
|
||||
tp := TestProposal
|
||||
proposal, err := keeper.SubmitProposal(ctx, tp)
|
||||
require.NoError(t, err)
|
||||
proposalID := proposal.ProposalID
|
||||
proposal.Status = types.StatusVotingPeriod
|
||||
keeper.SetProposal(ctx, proposal)
|
||||
|
||||
require.NoError(t, keeper.AddVote(ctx, proposalID, valAccAddr1, types.OptionNo))
|
||||
require.NoError(t, keeper.AddVote(ctx, proposalID, valAccAddr2, types.OptionYes))
|
||||
|
||||
proposal, ok := keeper.GetProposal(ctx, proposalID)
|
||||
require.True(t, ok)
|
||||
passes, burnDeposits, tallyResults := keeper.Tally(ctx, proposal)
|
||||
|
||||
require.True(t, passes)
|
||||
require.False(t, burnDeposits)
|
||||
require.False(t, tallyResults.Equals(types.EmptyTallyResult()))
|
||||
}
|
||||
|
||||
func TestTallyOnlyValidatorsVetoed(t *testing.T) {
|
||||
ctx, _, _, keeper, sk, _ := createTestInput(t, false, 100)
|
||||
createValidators(ctx, sk, []int64{6, 6, 7})
|
||||
|
|
|
@ -108,3 +108,29 @@ func TestTallyOnlyValidators51No(t *testing.T) {
|
|||
require.False(t, passes)
|
||||
require.False(t, burnDeposits)
|
||||
}
|
||||
|
||||
func TestTallyOnlyValidators51Yes(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
ctx := app.BaseApp.NewContext(false, abci.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(ctx, app, []int64{5, 6, 0})
|
||||
valAccAddr1, valAccAddr2 := valAccAddrs[0], valAccAddrs[1]
|
||||
|
||||
tp := TestProposal
|
||||
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
|
||||
require.NoError(t, err)
|
||||
proposalID := proposal.ProposalID
|
||||
proposal.Status = types.StatusVotingPeriod
|
||||
app.GovKeeper.SetProposal(ctx, proposal)
|
||||
|
||||
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr1, types.OptionNo))
|
||||
require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr2, types.OptionYes))
|
||||
|
||||
proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID)
|
||||
require.True(t, ok)
|
||||
passes, burnDeposits, tallyResults := app.GovKeeper.Tally(ctx, proposal)
|
||||
|
||||
require.True(t, passes)
|
||||
require.False(t, burnDeposits)
|
||||
require.False(t, tallyResults.Equals(types.EmptyTallyResult()))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue